364 lines
15 KiB
React
364 lines
15 KiB
React
// Metro module 5348 (f5349).
|
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
import { Platform, processColor } from "react-native";
|
|
import * as _deepEqual from "./deepEqual";
|
|
import { INT32_MAX } from "./deepEqual";
|
|
import * as _touchDataToPressEvent from "./touchDataToPressEvent";
|
|
import { numberAsInset, addInsets, isTouchWithinInset } from "./touchDataToPressEvent";
|
|
import { PressableStateMachine } from "./PressableStateMachine";
|
|
import { useIsScreenReaderEnabled } from "./Module5351";
|
|
import * as _Module5352 from "./Module5352";
|
|
import { getStatesConfig } from "./Module5352";
|
|
import { GestureObjects } from "./Module5324";
|
|
import { applyRelationProp } from "./Module5353";
|
|
import { GestureDetector } from "./Module5309";
|
|
import Module5336 from "./Module5336";
|
|
const _excluded = ["testOnly_pressed", "hitSlop", "pressRetentionOffset", "delayHoverIn", "delayHoverOut", "delayLongPress", "unstable_pressDelay", "onHoverIn", "onHoverOut", "onPress", "onPressIn", "onPressOut", "onLongPress", "onLayout", "style", "children", "android_disableSound", "android_ripple", "disabled", "accessible", "simultaneousWithExternalGesture", "requireExternalGestureToFail", "blocksExternalGesture"];
|
|
const isTestEnv = _deepEqual.isTestEnv();
|
|
let isFabric = null;
|
|
const __initData = {
|
|
code: "function pnpm_PressableTsx1(event){const{hoverInTimeout,clearTimeout,delayHoverOut,hoverOutTimeout,setTimeout,onHoverOut,gestureToPressableEvent}=this.__closure;var _onHoverOut2;if(hoverInTimeout.current){clearTimeout(hoverInTimeout.current);}if(delayHoverOut){hoverOutTimeout.current=setTimeout(function(){var _onHoverOut;return(_onHoverOut=onHoverOut)===null||_onHoverOut===void 0?void 0:_onHoverOut(gestureToPressableEvent(event));},delayHoverOut);return;}(_onHoverOut2=onHoverOut)===null||_onHoverOut2===void 0||_onHoverOut2(gestureToPressableEvent(event));}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function pnpm_PressableTsx2(event){const{hoverOutTimeout,clearTimeout,delayHoverIn,hoverInTimeout,setTimeout,onHoverIn,gestureToPressableEvent}=this.__closure;var _onHoverIn2;if(hoverOutTimeout.current){clearTimeout(hoverOutTimeout.current);}if(delayHoverIn){hoverInTimeout.current=setTimeout(function(){var _onHoverIn;return(_onHoverIn=onHoverIn)===null||_onHoverIn===void 0?void 0:_onHoverIn(gestureToPressableEvent(event));},delayHoverIn);return;}(_onHoverIn2=onHoverIn)===null||_onHoverIn2===void 0||_onHoverIn2(gestureToPressableEvent(event));}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function pnpm_PressableTsx3(_event,success){const{Platform,stateMachine,StateMachineEvent,handleFinalize}=this.__closure;if(Platform.OS==='web'){if(success){stateMachine.handleEvent(StateMachineEvent.FINALIZE);}else{stateMachine.handleEvent(StateMachineEvent.CANCEL);}handleFinalize();}}"
|
|
};
|
|
const __initData4 = {
|
|
code: "function pnpm_PressableTsx4(event){const{gestureTouchToPressableEvent,stateMachine,handlePressOut}=this.__closure;const pressableEvent=gestureTouchToPressableEvent(event);stateMachine.reset();handlePressOut(pressableEvent,false);}"
|
|
};
|
|
const __initData5 = {
|
|
code: "function pnpm_PressableTsx5(){const{Platform,isScreenReaderEnabled,stateMachine,handleFinalize}=this.__closure;if(Platform.OS==='android'&&!isScreenReaderEnabled){stateMachine.reset();handleFinalize();}}"
|
|
};
|
|
const __initData6 = {
|
|
code: "function pnpm_PressableTsx6(event){const{gestureTouchToPressableEvent,stateMachine,StateMachineEvent}=this.__closure;const pressableEvent=gestureTouchToPressableEvent(event);stateMachine.handleEvent(StateMachineEvent.LONG_PRESS_TOUCHES_DOWN,pressableEvent);}"
|
|
};
|
|
const __initData7 = {
|
|
code: "function pnpm_PressableTsx7(_event,success){const{Platform,stateMachine,StateMachineEvent,handleFinalize}=this.__closure;if(Platform.OS!=='web'){if(success){stateMachine.handleEvent(StateMachineEvent.FINALIZE);}else{stateMachine.handleEvent(StateMachineEvent.CANCEL);}if(Platform.OS!=='ios'){handleFinalize();}}}"
|
|
};
|
|
const __initData8 = {
|
|
code: "function pnpm_PressableTsx8(){const{Platform,stateMachine,StateMachineEvent}=this.__closure;if(Platform.OS!=='android'){stateMachine.handleEvent(StateMachineEvent.NATIVE_START);}}"
|
|
};
|
|
const __initData9 = {
|
|
code: "function pnpm_PressableTsx9(){const{stateMachine,StateMachineEvent}=this.__closure;stateMachine.handleEvent(StateMachineEvent.NATIVE_BEGIN);}"
|
|
};
|
|
const __initData10 = {
|
|
code: "function pnpm_PressableTsx10(event){const{Platform,gestureTouchToPressableEvent,stateMachine,handlePressOut}=this.__closure;if(Platform.OS!=='macos'&&Platform.OS!=='web'){const pressableEvent=gestureTouchToPressableEvent(event);stateMachine.reset();handlePressOut(pressableEvent,false);}}"
|
|
};
|
|
export default (a0) => {
|
|
let c14817_22, callback, callback2, callback3, callback4, callback5, callback6, callback7, memo2, isScreenReaderEnabled, ref6, ref7, c14817_34;
|
|
let testOnly_pressed = a0.testOnly_pressed;
|
|
const { hitSlop, pressRetentionOffset, delayHoverIn, delayHoverOut, delayLongPress, unstable_pressDelay, onHoverIn, onHoverOut, onPress, onPressIn, onPressOut, onLongPress, onLayout, style, children } = a0;
|
|
let android_disableSound = a0.android_disableSound;
|
|
const { android_ripple, disabled, accessible, simultaneousWithExternalGesture, requireExternalGestureToFail, blocksExternalGesture, ...rest } = a0;
|
|
let c14817_14 = {
|
|
simultaneousWithExternalGesture,
|
|
requireExternalGestureToFail,
|
|
blocksExternalGesture
|
|
};
|
|
if (testOnly_pressed == null) {
|
|
testOnly_pressed = false;
|
|
}
|
|
const [pressed, setState] = useState(testOnly_pressed);
|
|
const ref = useRef(null);
|
|
const ref2 = useRef(null);
|
|
const ref3 = useRef(true);
|
|
const ref4 = useRef(false);
|
|
const ref5 = useRef({
|
|
width: 0,
|
|
height: 0
|
|
});
|
|
const memo = useMemo(() => typeof hitSlop === "number" ? numberAsInset(hitSlop) : hitSlop == null ? {} : hitSlop, [hitSlop]);
|
|
const hitSlop2 = addInsets(memo, useMemo(() => typeof pressRetentionOffset === "number" ? numberAsInset(pressRetentionOffset) : pressRetentionOffset == null ? {} : pressRetentionOffset, [pressRetentionOffset]));
|
|
c14817_22 = hitSlop2;
|
|
callback = useCallback(() => {
|
|
if (ref.current) {
|
|
clearTimeout(ref.current);
|
|
ref.current = null;
|
|
ref3.current = true;
|
|
}
|
|
}, []);
|
|
callback2 = useCallback(() => {
|
|
if (ref2.current) {
|
|
clearTimeout(ref2.current);
|
|
ref2.current = null;
|
|
}
|
|
}, []);
|
|
callback3 = useCallback((c25439_0) => {
|
|
if (onLongPress) {
|
|
callback();
|
|
const r11 = setTimeout;
|
|
let r12 = delayLongPress;
|
|
if (delayLongPress == null) {
|
|
r12 = 500;
|
|
}
|
|
ref.current = r11(() => {
|
|
ref3.current = false;
|
|
onLongPress(c25439_0);
|
|
}, r12);
|
|
}
|
|
}, [onLongPress, callback, delayLongPress]);
|
|
callback4 = useCallback((a0) => {
|
|
if (onPressIn != null) {
|
|
onPressIn(a0);
|
|
}
|
|
callback3(a0);
|
|
setState(true);
|
|
if (ref2.current) {
|
|
clearTimeout(ref2.current);
|
|
ref2.current = null;
|
|
}
|
|
}, [onPressIn, callback3]);
|
|
callback5 = useCallback(() => {
|
|
ref4.current = false;
|
|
callback();
|
|
callback2();
|
|
setState(false);
|
|
}, [callback2, callback]);
|
|
callback6 = useCallback((a0) => {
|
|
if (isTouchWithinInset(ref5.current, memo, a0.nativeEvent.changedTouches.at(-1))) {
|
|
ref4.current = true;
|
|
if (unstable_pressDelay) {
|
|
ref2.current = setTimeout(() => {
|
|
callback4(a0);
|
|
}, unstable_pressDelay);
|
|
} else {
|
|
callback4(a0);
|
|
}
|
|
}
|
|
}, [callback4, memo, unstable_pressDelay]);
|
|
callback7 = useCallback(function(a0, r5 = true) {
|
|
if (ref4.current) {
|
|
ref4.current = false;
|
|
if (ref2.current) {
|
|
callback4(a0);
|
|
}
|
|
if (onPressOut != null) {
|
|
onPressOut(a0);
|
|
}
|
|
if (ref3.current && r5 && onPress != null) {
|
|
onPress(a0);
|
|
}
|
|
callback5();
|
|
}
|
|
}, [callback5, callback4, onPress, onPressOut]);
|
|
memo2 = useMemo(() => new PressableStateMachine(), []);
|
|
isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
useEffect(() => {
|
|
memo2.setStates(getStatesConfig(callback6, callback7, isScreenReaderEnabled));
|
|
}, [callback6, callback7, memo2, isScreenReaderEnabled]);
|
|
ref6 = useRef(null);
|
|
ref7 = useRef(null);
|
|
const memo3 = useMemo(() => {
|
|
const r5 = GestureObjects.Hover().manualActivation(true).cancelsTouchesInView(false);
|
|
const r23 = function n(a0) {
|
|
if (ref7.current) {
|
|
clearTimeout(ref7.current);
|
|
}
|
|
if (delayHoverIn) {
|
|
ref6.current = setTimeout(() => onHoverIn == null ? void 0 : onHoverIn(_touchDataToPressEvent.gestureToPressableEvent(a0)), delayHoverIn);
|
|
} else if (onHoverIn != null) {
|
|
onHoverIn(_touchDataToPressEvent.gestureToPressableEvent(a0));
|
|
}
|
|
};
|
|
r23.__closure = {
|
|
hoverOutTimeout: ref7,
|
|
clearTimeout,
|
|
delayHoverIn,
|
|
hoverInTimeout: ref6,
|
|
setTimeout,
|
|
onHoverIn,
|
|
gestureToPressableEvent: _touchDataToPressEvent.gestureToPressableEvent
|
|
};
|
|
r23.__workletHash = 145410820733;
|
|
r23.__initData = __initData2;
|
|
const r31 = r5.onBegin(r23);
|
|
const r33 = function t(a0) {
|
|
if (ref6.current) {
|
|
clearTimeout(ref6.current);
|
|
}
|
|
if (delayHoverOut) {
|
|
ref7.current = setTimeout(() => onHoverOut == null ? void 0 : onHoverOut(_touchDataToPressEvent.gestureToPressableEvent(a0)), delayHoverOut);
|
|
} else if (onHoverOut != null) {
|
|
onHoverOut(_touchDataToPressEvent.gestureToPressableEvent(a0));
|
|
}
|
|
};
|
|
r33.__closure = {
|
|
hoverInTimeout: ref6,
|
|
clearTimeout,
|
|
delayHoverOut,
|
|
hoverOutTimeout: ref7,
|
|
setTimeout,
|
|
onHoverOut,
|
|
gestureToPressableEvent: _touchDataToPressEvent.gestureToPressableEvent
|
|
};
|
|
r33.__workletHash = 117886059607;
|
|
r33.__initData = __initData;
|
|
return r31.onFinalize(r33);
|
|
}, [delayHoverIn, delayHoverOut, onHoverIn, onHoverOut]);
|
|
const memo4 = useMemo(() => {
|
|
const r28 = GestureObjects.LongPress().minDuration(INT32_MAX).maxDistance(INT32_MAX).cancelsTouchesInView(false);
|
|
const r30 = function(a0) {
|
|
memo2.handleEvent(_Module5352.StateMachineEvent.LONG_PRESS_TOUCHES_DOWN, _touchDataToPressEvent.gestureTouchToPressableEvent(a0));
|
|
};
|
|
r30.__closure = {
|
|
gestureTouchToPressableEvent: _touchDataToPressEvent.gestureTouchToPressableEvent,
|
|
stateMachine: memo2,
|
|
StateMachineEvent: _Module5352.StateMachineEvent
|
|
};
|
|
r30.__workletHash = 5538605329543;
|
|
r30.__initData = __initData6;
|
|
const r37 = r28.onTouchesDown(r30);
|
|
const r39 = function() {
|
|
if (!isScreenReaderEnabled) {
|
|
memo2.reset();
|
|
callback5();
|
|
}
|
|
};
|
|
r39.__closure = {
|
|
Platform,
|
|
isScreenReaderEnabled,
|
|
stateMachine: memo2,
|
|
handleFinalize: callback5
|
|
};
|
|
r39.__workletHash = 8055694403599;
|
|
r39.__initData = __initData5;
|
|
const r45 = r37.onTouchesUp(r39);
|
|
const r47 = function n(a0) {
|
|
const r10 = _touchDataToPressEvent.gestureTouchToPressableEvent(a0);
|
|
memo2.reset();
|
|
callback7(r10, false);
|
|
};
|
|
r47.__closure = {
|
|
gestureTouchToPressableEvent: _touchDataToPressEvent.gestureTouchToPressableEvent,
|
|
stateMachine: memo2,
|
|
handlePressOut: callback7
|
|
};
|
|
r47.__workletHash = 8223505277740;
|
|
r47.__initData = __initData4;
|
|
const r54 = r45.onTouchesCancelled(r47);
|
|
const r56 = function t(a0, a1) {};
|
|
r56.__closure = {
|
|
Platform,
|
|
stateMachine: memo2,
|
|
StateMachineEvent: _Module5352.StateMachineEvent,
|
|
handleFinalize: callback5
|
|
};
|
|
r56.__workletHash = 946627735228;
|
|
r56.__initData = __initData3;
|
|
return r54.onFinalize(r56);
|
|
}, [memo2, callback5, callback7, isScreenReaderEnabled]);
|
|
const memo5 = useMemo(() => {
|
|
const r4 = GestureObjects.Native();
|
|
const r16 = function(a0) {
|
|
const r10 = _touchDataToPressEvent.gestureTouchToPressableEvent(a0);
|
|
memo2.reset();
|
|
callback7(r10, false);
|
|
};
|
|
r16.__closure = {
|
|
Platform,
|
|
gestureTouchToPressableEvent: _touchDataToPressEvent.gestureTouchToPressableEvent,
|
|
stateMachine: memo2,
|
|
handlePressOut: callback7
|
|
};
|
|
r16.__workletHash = 9061249296673;
|
|
r16.__initData = __initData10;
|
|
const r21 = r4.onTouchesCancelled(r16);
|
|
const r23 = function() {
|
|
memo2.handleEvent(_Module5352.StateMachineEvent.NATIVE_BEGIN);
|
|
};
|
|
r23.__closure = {
|
|
stateMachine: memo2,
|
|
StateMachineEvent: _Module5352.StateMachineEvent
|
|
};
|
|
r23.__workletHash = 11605577071200;
|
|
r23.__initData = __initData9;
|
|
const r30 = r21.onBegin(r23);
|
|
const r32 = function n() {};
|
|
r32.__closure = {
|
|
Platform,
|
|
stateMachine: memo2,
|
|
StateMachineEvent: _Module5352.StateMachineEvent
|
|
};
|
|
r32.__workletHash = 1583717288778;
|
|
r32.__initData = __initData8;
|
|
const r39 = r30.onStart(r32);
|
|
const r41 = function t(a0, a1) {
|
|
if (a1) {
|
|
memo2.handleEvent(_Module5352.StateMachineEvent.FINALIZE);
|
|
} else {
|
|
memo2.handleEvent(_Module5352.StateMachineEvent.CANCEL);
|
|
}
|
|
callback5();
|
|
};
|
|
r41.__closure = {
|
|
Platform,
|
|
stateMachine: memo2,
|
|
StateMachineEvent: _Module5352.StateMachineEvent,
|
|
handleFinalize: callback5
|
|
};
|
|
r41.__workletHash = 13697558324309;
|
|
r41.__initData = __initData7;
|
|
return r39.onFinalize(r41);
|
|
}, [memo2, callback7, callback5]);
|
|
const enabled = disabled !== true;
|
|
c14817_34 = enabled;
|
|
const r119 = [memo5, memo4, memo3];
|
|
const _loop = function _loop(a0) {
|
|
a0.enabled(c14817_34);
|
|
a0.runOnJS(true);
|
|
a0.hitSlop(c14817_22);
|
|
Object.entries(c14817_14).forEach((item) => {
|
|
const [r7, r24] = item;
|
|
applyRelationProp(a0, r7, r24);
|
|
});
|
|
};
|
|
for (const item of r119) {
|
|
_loop(item);
|
|
}
|
|
const gesture = GestureObjects.Simultaneous.apply(GestureObjects, [...r119]);
|
|
let r142 = style;
|
|
if (typeof r142 === "function") {
|
|
r142 = style({
|
|
pressed
|
|
});
|
|
}
|
|
let r144 = children;
|
|
if (typeof r144 === "function") {
|
|
r144 = children({
|
|
pressed
|
|
});
|
|
}
|
|
const memo6 = useMemo(() => {
|
|
if (isFabric === null) {
|
|
isFabric = _deepEqual.isFabric();
|
|
}
|
|
const r13 = android_ripple ? void 0 : "transparent";
|
|
let r15 = android_ripple?.color;
|
|
if (r15 == null) {
|
|
r15 = r13;
|
|
}
|
|
return isFabric ? r15 : processColor(r15);
|
|
}, [android_ripple]);
|
|
const callback8 = useCallback((a0) => {
|
|
if (onLayout != null) {
|
|
onLayout(a0);
|
|
}
|
|
ref5.current = a0.nativeEvent.layout;
|
|
}, [onLayout]);
|
|
if (android_disableSound == null) {
|
|
android_disableSound = void 0;
|
|
}
|
|
let rippleRadius = android_ripple?.radius;
|
|
if (rippleRadius == null) {
|
|
rippleRadius = void 0;
|
|
}
|
|
return <GestureDetector gesture={gesture}>
|
|
<Module5336 {...rest} onLayout={callback8} accessible={accessible !== false} hitSlop={hitSlop2} enabled={enabled} touchSoundDisabled={android_disableSound} rippleColor={memo6} rippleRadius={rippleRadius} style={[{}, r142]} testOnly_onPress={isTestEnv ? onPress : void 0} testOnly_onPressIn={isTestEnv ? onPressIn : void 0} testOnly_onPressOut={isTestEnv ? onPressOut : void 0} testOnly_onLongPress={isTestEnv ? onLongPress : void 0}>
|
|
{r144}
|
|
{null}
|
|
</Module5336>
|
|
</GestureDetector>;
|
|
};
|