212 lines
7.9 KiB
React
212 lines
7.9 KiB
React
// Metro module 5335 (f5336).
|
|
import _objectWithoutProperties from "./_objectWithoutProperties";
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _possibleConstructorReturn from "./_possibleConstructorReturn";
|
|
import _getPrototypeOf from "./_getPrototypeOf";
|
|
import _inherits from "./_inherits";
|
|
import * as _Module19 from "react";
|
|
import { Component, forwardRef } from "react";
|
|
import { Animated, Platform, StyleSheet, processColor } from "react-native";
|
|
import { jsx } from "react/jsx-runtime";
|
|
import createNativeWrapper from "./createNativeWrapper";
|
|
import Module5336 from "./Module5336";
|
|
import { State } from "./Module5278";
|
|
import * as _deepEqual from "./deepEqual";
|
|
let _excluded, _excluded2, _excluded3, Component4, Component5, Component6, Component7, Component9, styles, Component8, Component10;
|
|
let InnerBaseButton;
|
|
let InnerRectButton;
|
|
let InnerBorderlessButton;
|
|
let env3245 = {};
|
|
env3245[14] = function _isNativeReflectConstruct() {
|
|
let c14809_0;
|
|
try {
|
|
c14809_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c14809_0;
|
|
};
|
|
env3245[14] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
_excluded = ["rippleColor", "style"];
|
|
_excluded2 = ["children", "style"];
|
|
_excluded3 = ["children", "style", "innerRef"];
|
|
const Animated2 = Animated;
|
|
Platform;
|
|
const StyleSheet2 = StyleSheet;
|
|
Component4 = createNativeWrapper(Module5336, {
|
|
shouldCancelWhenOutside: false,
|
|
shouldActivateOnStart: false
|
|
});
|
|
env3245[16] = null;
|
|
InnerBaseButton = function InnerBaseButton(a0) {
|
|
_classCallCheck(this, InnerBaseButton);
|
|
const r9 = [a0];
|
|
const r8 = _getPrototypeOf(InnerBaseButton);
|
|
const r22 = _possibleConstructorReturn(this, (0, env3245[14])() ? Reflect.construct(r8, r9, _getPrototypeOf(this).constructor) : r8.apply(this, r9));
|
|
r22.handleEvent = ({ nativeEvent }) => {
|
|
const { state, oldState, pointerInside } = nativeEvent;
|
|
const lastActive = pointerInside ? state === State.ACTIVE : pointerInside;
|
|
if (lastActive !== this.lastActive && this.props.onActiveStateChange) {
|
|
this.props.onActiveStateChange(lastActive);
|
|
}
|
|
const longPressDetected = this.longPressDetected;
|
|
if ((longPressDetected ? !longPressDetected : oldState === State.ACTIVE) && state !== State.CANCELLED && this.lastActive && this.props.onPress) {
|
|
this.props.onPress(pointerInside);
|
|
}
|
|
L35: {
|
|
if (!this.lastActive && (state === State.BEGAN && pointerInside)) {
|
|
this.longPressDetected = false;
|
|
if (!this.props.onLongPress) {
|
|
break L35;
|
|
}
|
|
this.longPressTimeout = setTimeout(this.onLongPress, this.props.delayLongPress);
|
|
} else if (!((state !== State.ACTIVE || pointerInside || this.longPressTimeout === void 0) && (this.longPressTimeout === void 0 || state !== State.END && state !== State.CANCELLED && state !== State.FAILED))) {
|
|
clearTimeout(this.longPressTimeout);
|
|
this.longPressTimeout = void 0;
|
|
}
|
|
}
|
|
this.lastActive = lastActive;
|
|
};
|
|
r22.onLongPress = () => {
|
|
this.longPressDetected = true;
|
|
const props = this.props;
|
|
const onLongPress = props.onLongPress;
|
|
if (onLongPress != null) {
|
|
onLongPress.call(props);
|
|
}
|
|
};
|
|
r22.onHandlerStateChange = (a0) => {
|
|
const props = this.props;
|
|
const onHandlerStateChange = props.onHandlerStateChange;
|
|
if (onHandlerStateChange != null) {
|
|
onHandlerStateChange.call(props, a0);
|
|
}
|
|
this.handleEvent(a0);
|
|
};
|
|
r22.onGestureEvent = (a0) => {
|
|
const props = this.props;
|
|
const onGestureEvent = props.onGestureEvent;
|
|
if (onGestureEvent != null) {
|
|
onGestureEvent.call(props, a0);
|
|
}
|
|
this.handleEvent(a0);
|
|
};
|
|
r22.lastActive = false;
|
|
r22.longPressDetected = false;
|
|
return r22;
|
|
};
|
|
_inherits(InnerBaseButton, Component);
|
|
Component5 = _createClass(InnerBaseButton, [{
|
|
key: "render",
|
|
value: function render() {
|
|
const props = this.props;
|
|
const { rippleColor, style, ...rest } = props;
|
|
let r13 = env3245[16];
|
|
if (r13 === null) {
|
|
const isFabric = _deepEqual.isFabric();
|
|
env3245[16] = isFabric;
|
|
r13 = isFabric;
|
|
}
|
|
return <Component4 ref={this.props.innerRef} rippleColor={r13 ? rippleColor : processColor(rippleColor == null ? void 0 : rippleColor)} style={[style, false]} {...rest} onGestureEvent={this.onGestureEvent} onHandlerStateChange={this.onHandlerStateChange} />;
|
|
}
|
|
}]);
|
|
Component5.defaultProps = {
|
|
delayLongPress: 600
|
|
};
|
|
Component6 = Animated2.createAnimatedComponent(Component5);
|
|
Component7 = forwardRef((a0, a1) => <Component5 innerRef={a1} {...a0} />);
|
|
Component9 = forwardRef((a0, a1) => <Component6 innerRef={a1} {...a0} />);
|
|
styles = StyleSheet2.create({
|
|
underlay: {
|
|
position: "absolute",
|
|
left: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
top: 0
|
|
}
|
|
});
|
|
const Component2 = _Module19.Component;
|
|
InnerRectButton = function InnerRectButton(a0) {
|
|
_classCallCheck(this, InnerRectButton);
|
|
const r10 = [a0];
|
|
const r9 = _getPrototypeOf(InnerRectButton);
|
|
const r27 = _possibleConstructorReturn(this, (0, env3245[14])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
|
|
r27.onActiveStateChange = (a0) => {
|
|
const props = this.props;
|
|
const onActiveStateChange = props.onActiveStateChange;
|
|
if (onActiveStateChange != null) {
|
|
onActiveStateChange.call(props, a0);
|
|
}
|
|
};
|
|
r27.opacity = new Animated.Value(0);
|
|
return r27;
|
|
};
|
|
_inherits(InnerRectButton, Component2);
|
|
Component8 = _createClass(InnerRectButton, [{
|
|
key: "render",
|
|
value: function render() {
|
|
const props = this.props;
|
|
const { children, style, ...rest } = props;
|
|
let style2 = StyleSheet.flatten(style);
|
|
if (style2 == null) {
|
|
style2 = {};
|
|
}
|
|
return <Component7 {...rest} ref={this.props.innerRef} style={style2} onActiveStateChange={this.onActiveStateChange}>
|
|
{(0, jsx)(Animated.View, {
|
|
style: [styles.underlay, {
|
|
opacity: this.opacity,
|
|
backgroundColor: this.props.underlayColor,
|
|
borderRadius: style2.borderRadius,
|
|
borderTopLeftRadius: style2.borderTopLeftRadius,
|
|
borderTopRightRadius: style2.borderTopRightRadius,
|
|
borderBottomLeftRadius: style2.borderBottomLeftRadius,
|
|
borderBottomRightRadius: style2.borderBottomRightRadius
|
|
}]
|
|
})}
|
|
{children}
|
|
</Component7>;
|
|
}
|
|
}]);
|
|
Component8.defaultProps = {
|
|
activeOpacity: 0.105,
|
|
underlayColor: "black"
|
|
};
|
|
const r80 = forwardRef((a0, a1) => <Component8 innerRef={a1} {...a0} />);
|
|
const Component3 = _Module19.Component;
|
|
InnerBorderlessButton = function InnerBorderlessButton(a0) {
|
|
_classCallCheck(this, InnerBorderlessButton);
|
|
const r10 = [a0];
|
|
const r9 = _getPrototypeOf(InnerBorderlessButton);
|
|
const r27 = _possibleConstructorReturn(this, (0, env3245[14])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
|
|
r27.onActiveStateChange = (a0) => {
|
|
const props = this.props;
|
|
const onActiveStateChange = props.onActiveStateChange;
|
|
if (onActiveStateChange != null) {
|
|
onActiveStateChange.call(props, a0);
|
|
}
|
|
};
|
|
r27.opacity = new Animated.Value(1);
|
|
return r27;
|
|
};
|
|
_inherits(InnerBorderlessButton, Component3);
|
|
Component10 = _createClass(InnerBorderlessButton, [{
|
|
key: "render",
|
|
value: function render() {
|
|
const props = this.props;
|
|
const { children, style, innerRef } = props;
|
|
return <Component9 {..._objectWithoutProperties(props, _excluded3)} innerRef={innerRef} onActiveStateChange={this.onActiveStateChange} style={[style, false]}>{children}</Component9>;
|
|
}
|
|
}]);
|
|
Component10.defaultProps = {
|
|
activeOpacity: 0.3,
|
|
borderless: true
|
|
};
|
|
const r92 = forwardRef((a0, a1) => <Component10 innerRef={a1} {...a0} />);
|
|
export { Component4 as RawButton };
|
|
export { Component7 as BaseButton };
|
|
export { r80 as RectButton };
|
|
export { r92 as BorderlessButton };
|
|
export { Module5336 as PureNativeButton };
|