461 lines
22 KiB
TypeScript
461 lines
22 KiB
TypeScript
// Metro module 9299 (f9300).
|
|
import { useEffect, useMemo, useRef, useLayoutEffect, useCallback } from "react";
|
|
import { isFabric } from "../../../../utils/native/FabricUtils";
|
|
import * as _PlatformUtils from "../../../../utils/PlatformUtils";
|
|
import { isAndroid } from "../../../../utils/PlatformUtils";
|
|
import * as _ReanimatedRexport from "../../../../modules/reanimated/ReanimatedRexport";
|
|
import { useAnimatedRef, useSharedValue, runOnUI } from "../../../../modules/reanimated/ReanimatedRexport";
|
|
import useWindowDimensions_native from "../../../../modules/screen/useWindowDimensions.native";
|
|
import * as _ContextMenuState_native from "./ContextMenuState.native";
|
|
import { useContextMenuState, useActiveContextMenu, resetContextMenuState, hideContextMenu, showContextMenu } from "./ContextMenuState.native";
|
|
import { useFontScale } from "../../../../modules/screen/native/useFontScale";
|
|
import * as _ContextMenuConstants_native from "./ContextMenuConstants.native";
|
|
import { CONTEXT_MENU_ITEM_BASE_HEIGHT, CONTEXT_MENU_ITEM_PADDING, CONTEXT_MENU_LONG_PRESS_DURATION_MS } from "./ContextMenuConstants.native";
|
|
import { setAccessibilityFocus } from "../../../../modules/a11y/native/setAccessibilityFocus.android";
|
|
import { uid } from "../../../../modules/core/web/UID";
|
|
import { AccessibilityAnnouncer } from "../../../shared";
|
|
import * as _index_native from "../../../../intl/index.native";
|
|
import { intl } from "../../../../intl/index.native";
|
|
import * as _FWOMeasureUtils from "../../../../modules/screen/native/FWOMeasureUtils";
|
|
import { Gesture, GestureDetector } from "../../../../_bundle/Module5273";
|
|
import * as _HapticUtils_native from "../../../../modules/haptics/HapticUtils.native";
|
|
import { getIsScreenReaderEnabled } from "../../../../modules/a11y/native/useIsScreenReaderEnabled.native";
|
|
const isIOS = isFabric() && _PlatformUtils.isIOS();
|
|
const __initData = {
|
|
code: "function ContextMenuNativeTsx1(){const{_isFabricIOS,buttonTagSV,measureInWindowForFWO,measure,buttonRef,title,itemCount,dividerIndexes,approximateItemHeight,CONTEXT_MENU_DIVIDER_HEIGHT,CONTEXT_MENU_OFFSET,screenHeight,CONTEXT_MENU_EDGE_OFFSET,screenWidth,CONTEXT_MENU_MIN_WIDTH,menuAlign,runOnJS,showMenu}=this.__closure;let pageX;let pageY;let width;let height;if(_isFabricIOS){const tag=buttonTagSV.get();if(tag===-1)return;const m=measureInWindowForFWO(tag);if(m==null)return;pageX=m.x;pageY=m.y;width=m.width;height=m.height;}else{const m=measure(buttonRef);if(m==null)return;pageX=m.pageX;pageY=m.pageY;width=m.width;height=m.height;}const rowCount=title!=null?itemCount+1:itemCount;const dividerCount=(title!=null?1:0)+dividerIndexes.length;const menuHeight=approximateItemHeight.get()*rowCount+CONTEXT_MENU_DIVIDER_HEIGHT*dividerCount;const positionBelowOffset=pageY+height+CONTEXT_MENU_OFFSET;const positionAboveOffset=screenHeight-pageY+CONTEXT_MENU_OFFSET;const availableSpaceBelow=screenHeight-positionBelowOffset-CONTEXT_MENU_EDGE_OFFSET;const availableSpaceAbove=pageY-CONTEXT_MENU_EDGE_OFFSET;const wouldOverflowBelow=availableSpaceBelow<menuHeight;const wouldOverflowAbove=availableSpaceAbove<menuHeight;const minimumRightPosition=Math.max(screenWidth-pageX-width,CONTEXT_MENU_EDGE_OFFSET);function autoPositionVertical(offset){'worklet';let positionY='below';let y=pageY+height+CONTEXT_MENU_OFFSET;if(wouldOverflowBelow===wouldOverflowAbove){if(availableSpaceBelow>availableSpaceAbove){positionY='below';}else{positionY='above';}}else if(wouldOverflowBelow){positionY='above';}else{positionY='below';}y=(positionY==='above'?positionAboveOffset:positionBelowOffset)+(offset!==null&&offset!==void 0?offset:0);return{y:y,positionY:positionY};}function autoPositionHorizontal(){'worklet';const distanceFromLeftEdge=pageX-CONTEXT_MENU_EDGE_OFFSET;const distanceFromRightEdge=screenWidth-CONTEXT_MENU_EDGE_OFFSET-(pageX+CONTEXT_MENU_MIN_WIDTH);let positionX='left';let x=pageX;if(distanceFromLeftEdge>distanceFromRightEdge){positionX='right';x=minimumRightPosition;}return{x:x,positionX:positionX};}if(menuAlign==='auto'){const{y:y,positionY:positionY}=autoPositionVertical();const{x:x,positionX:positionX}=autoPositionHorizontal();runOnJS(showMenu)(x,y,positionX,positionY,menuHeight,width);}else if(menuAlign==='above'||menuAlign==='below'){const positionY=menuAlign;const y=positionY==='above'?positionAboveOffset:positionBelowOffset;const{x:x,positionX:positionX}=autoPositionHorizontal();runOnJS(showMenu)(x,y,positionX,positionY,menuHeight,width);}else{const positionX=menuAlign==='left'?'right':'left';const x=positionX==='left'?pageX+width+CONTEXT_MENU_OFFSET:minimumRightPosition+width+CONTEXT_MENU_OFFSET;const{y:y,positionY:positionY}=autoPositionVertical(-1*(CONTEXT_MENU_OFFSET+height));runOnJS(showMenu)(x,y,positionX,positionY,menuHeight,width);}}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function autoPositionVertical_ContextMenuNativeTsx2(offset){const{pageY,height,CONTEXT_MENU_OFFSET,wouldOverflowBelow,wouldOverflowAbove,availableSpaceBelow,availableSpaceAbove,positionAboveOffset,positionBelowOffset}=this.__closure;let positionY='below';let y=pageY+height+CONTEXT_MENU_OFFSET;if(wouldOverflowBelow===wouldOverflowAbove){if(availableSpaceBelow>availableSpaceAbove){positionY='below';}else{positionY='above';}}else if(wouldOverflowBelow){positionY='above';}else{positionY='below';}y=(positionY==='above'?positionAboveOffset:positionBelowOffset)+(offset!==null&&offset!==void 0?offset:0);return{y:y,positionY:positionY};}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function autoPositionHorizontal_ContextMenuNativeTsx3(){const{pageX,CONTEXT_MENU_EDGE_OFFSET,screenWidth,CONTEXT_MENU_MIN_WIDTH,minimumRightPosition}=this.__closure;const distanceFromLeftEdge=pageX-CONTEXT_MENU_EDGE_OFFSET;const distanceFromRightEdge=screenWidth-CONTEXT_MENU_EDGE_OFFSET-(pageX+CONTEXT_MENU_MIN_WIDTH);let positionX='left';let x=pageX;if(distanceFromLeftEdge>distanceFromRightEdge){positionX='right';x=minimumRightPosition;}return{x:x,positionX:positionX};}"
|
|
};
|
|
const __initData4 = {
|
|
code: "function onPanGestureEnd_ContextMenuNativeTsx4(){const{state,runOnJS,requestClose}=this.__closure;const{activeIndex:activeIndex}=state;const isDismiss=activeIndex.get()===-1;runOnJS(requestClose)(isDismiss);}"
|
|
};
|
|
const __initData5 = {
|
|
code: "function ContextMenuNativeTsx5(e){const{updateContextMenuState,state}=this.__closure;updateContextMenuState(e.absoluteX,e.absoluteY,state);}"
|
|
};
|
|
const __initData6 = {
|
|
code: "function ContextMenuNativeTsx6(){const{runOnJS,triggerHapticFeedback,CONTEXT_MENU_OPEN_HAPTIC,measureButtonAndShowMenu}=this.__closure;runOnJS(triggerHapticFeedback)(CONTEXT_MENU_OPEN_HAPTIC);measureButtonAndShowMenu();}"
|
|
};
|
|
const __initData7 = {
|
|
code: "function ContextMenuNativeTsx7(){const{measureButtonAndShowMenu}=this.__closure;measureButtonAndShowMenu();}"
|
|
};
|
|
const __initData8 = {
|
|
code: "function ContextMenuNativeTsx8(e){const{updateContextMenuState,state}=this.__closure;updateContextMenuState(e.absoluteX,e.absoluteY,state);}"
|
|
};
|
|
const __initData9 = {
|
|
code: "function ContextMenuNativeTsx9(){const{runOnJS,triggerHapticFeedback,CONTEXT_MENU_OPEN_HAPTIC,measureButtonAndShowMenu}=this.__closure;runOnJS(triggerHapticFeedback)(CONTEXT_MENU_OPEN_HAPTIC);measureButtonAndShowMenu();}"
|
|
};
|
|
export function ContextMenu(props) {
|
|
let items2, dividerIndexes, length, width, height, contextMenuState, activeIndex, activeContextMenu, sharedValue2, ref, callback, callback2, callback3, callback4;
|
|
const { children, items, triggerOnLongPress = false } = props;
|
|
let c17122_1 = triggerOnLongPress;
|
|
let triggerOnTap = props.triggerOnTap;
|
|
if (triggerOnTap === void 0) {
|
|
triggerOnTap = false;
|
|
}
|
|
let c17122_2 = triggerOnTap;
|
|
const { disableGesture = false, align = "auto" } = props;
|
|
let c17122_3 = align;
|
|
const { title, onOpen, onClose, keyboardShouldPersistTaps } = props;
|
|
let returnRef2 = props.returnRef;
|
|
let returnRef = returnRef2;
|
|
let enabled = props.enabled;
|
|
if (enabled === void 0) {
|
|
enabled = true;
|
|
}
|
|
let c17122_9 = enabled;
|
|
let buttonRef2 = props.buttonRef;
|
|
let buttonRef = buttonRef2;
|
|
items2 = void 0;
|
|
dividerIndexes = void 0;
|
|
length = void 0;
|
|
width = void 0;
|
|
height = void 0;
|
|
contextMenuState = void 0;
|
|
activeIndex = void 0;
|
|
activeContextMenu = void 0;
|
|
sharedValue2 = void 0;
|
|
ref = void 0;
|
|
callback = void 0;
|
|
callback2 = void 0;
|
|
callback3 = void 0;
|
|
callback4 = void 0;
|
|
const animatedRef = useAnimatedRef();
|
|
if (buttonRef2 == null) {
|
|
buttonRef2 = animatedRef;
|
|
}
|
|
buttonRef = buttonRef2;
|
|
const sharedValue = useSharedValue(-1);
|
|
useEffect(() => buttonRef.observe((a0) => {
|
|
if (a0 != null) {
|
|
sharedValue.set(a0);
|
|
}
|
|
}), [buttonRef2, sharedValue]);
|
|
const memo = useMemo(() => {
|
|
const isArray = Array.isArray(items[0]);
|
|
const items3 = isArray ? items.flat() : items;
|
|
let c26416_0 = items3;
|
|
const dividerIndexes2 = [];
|
|
let c26416_1 = dividerIndexes2;
|
|
if (isArray) {
|
|
items.forEach((item, index) => {
|
|
if (index > 0) {
|
|
c26416_1.push(c26416_0.indexOf(item[0]));
|
|
}
|
|
});
|
|
}
|
|
return {
|
|
items: items3,
|
|
dividerIndexes: dividerIndexes2
|
|
};
|
|
}, [items]);
|
|
items2 = memo.items;
|
|
dividerIndexes = memo.dividerIndexes;
|
|
length = items2.length;
|
|
const windowDimensions_native = useWindowDimensions_native({
|
|
ignoreKeyboard: isAndroid()
|
|
});
|
|
width = windowDimensions_native.width;
|
|
height = windowDimensions_native.height;
|
|
contextMenuState = useContextMenuState();
|
|
activeIndex = contextMenuState.activeIndex;
|
|
const fontScale = useFontScale();
|
|
if (returnRef2 === void 0) {
|
|
returnRef2 = buttonRef2;
|
|
}
|
|
returnRef = returnRef2;
|
|
activeContextMenu = useActiveContextMenu();
|
|
sharedValue2 = useSharedValue(Math.max((CONTEXT_MENU_ITEM_BASE_HEIGHT - 2 * CONTEXT_MENU_ITEM_PADDING) * fontScale + 2 * CONTEXT_MENU_ITEM_PADDING, CONTEXT_MENU_ITEM_BASE_HEIGHT));
|
|
ref = useRef(items2);
|
|
useLayoutEffect(() => {
|
|
ref.current = items2;
|
|
}, [items2]);
|
|
useLayoutEffect(() => {
|
|
if (activeContextMenu == null) {
|
|
resetContextMenuState(contextMenuState);
|
|
}
|
|
}, [activeContextMenu, contextMenuState]);
|
|
callback = useCallback((a0) => {
|
|
if (onClose != null) {
|
|
onClose(a0);
|
|
}
|
|
hideContextMenu();
|
|
const r17 = activeIndex.get();
|
|
if (r17 !== -1) {
|
|
const r20 = ref.current[r17];
|
|
if (r20 != null) {
|
|
r20.action();
|
|
}
|
|
}
|
|
}, [activeIndex, onClose]);
|
|
callback2 = useCallback(() => {
|
|
setAccessibilityFocus({
|
|
ref: returnRef
|
|
});
|
|
}, [returnRef2]);
|
|
callback3 = useCallback((a0, a1, a2, a3, a4, a5) => {
|
|
if (onOpen != null) {
|
|
onOpen();
|
|
}
|
|
showContextMenu({
|
|
key: uid(),
|
|
x: a0,
|
|
y: a1,
|
|
positionX: a2,
|
|
positionY: a3,
|
|
height: a4,
|
|
width: a5,
|
|
state: contextMenuState,
|
|
items: items2,
|
|
title,
|
|
keyboardShouldPersistTaps,
|
|
requestClose: callback,
|
|
onClose: callback2,
|
|
dividerIndexes
|
|
});
|
|
if (isAndroid()) {
|
|
AccessibilityAnnouncer.announce(intl.string(_index_native.t.ZqK0uI));
|
|
}
|
|
}, [onOpen, contextMenuState, items2, title, keyboardShouldPersistTaps, callback, callback2, dividerIndexes]);
|
|
const V = function V() {
|
|
let r12, r16, r20, r41, height2, pageX3, pageY, width2;
|
|
let pageX, c26417_1, c26417_2, c26417_3, c26417_4, c26417_5, c26417_6, c26417_7;
|
|
if (isIOS) {
|
|
const r15 = sharedValue.get();
|
|
if (r15 === -1) {
|
|
return void 0;
|
|
}
|
|
const r18 = _FWOMeasureUtils.measureInWindowForFWO(r15);
|
|
if (r18 == null) {
|
|
return void 0;
|
|
}
|
|
const r51 = r18.x;
|
|
pageX = r51;
|
|
pageY = r18.y;
|
|
width2 = r18.width;
|
|
height2 = r18.height;
|
|
r12 = r51;
|
|
pageX3 = r12;
|
|
r20 = height2;
|
|
r16 = pageY;
|
|
r41 = pageX3;
|
|
} else {
|
|
const r39 = _ReanimatedRexport.measure(buttonRef);
|
|
if (r39 == null) {
|
|
return void 0;
|
|
}
|
|
const pageX2 = r39.pageX;
|
|
pageX = pageX2;
|
|
pageY = r39.pageY;
|
|
width2 = r39.width;
|
|
height2 = r39.height;
|
|
r12 = pageX2;
|
|
pageX3 = r12;
|
|
r20 = height2;
|
|
r16 = pageY;
|
|
r41 = pageX3;
|
|
}
|
|
const r54 = title != null ? length + 1 : length;
|
|
const r58 = title != null ? 1 : 0;
|
|
L47: {
|
|
const r61 = r58 + dividerIndexes.length;
|
|
const r73 = sharedValue2.get() * r54 + _ContextMenuConstants_native.CONTEXT_MENU_DIVIDER_HEIGHT * r61;
|
|
let positionBelowOffset = r16 + r20 + _ContextMenuConstants_native.CONTEXT_MENU_OFFSET;
|
|
c26417_1 = positionBelowOffset;
|
|
const positionAboveOffset = height - r16 + _ContextMenuConstants_native.CONTEXT_MENU_OFFSET;
|
|
c26417_2 = positionAboveOffset;
|
|
const availableSpaceBelow = height - positionBelowOffset - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET;
|
|
c26417_3 = availableSpaceBelow;
|
|
const availableSpaceAbove = r16 - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET;
|
|
c26417_4 = availableSpaceAbove;
|
|
const wouldOverflowBelow = availableSpaceBelow < r73;
|
|
c26417_5 = wouldOverflowBelow;
|
|
const wouldOverflowAbove = availableSpaceAbove < r73;
|
|
c26417_6 = wouldOverflowAbove;
|
|
const minimumRightPosition = Math.max(width - r41 - width2, _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET);
|
|
c26417_7 = minimumRightPosition;
|
|
const autoPositionVertical = function autoPositionVertical(a0) {
|
|
_ContextMenuConstants_native.CONTEXT_MENU_OFFSET;
|
|
const positionY = c26417_5 === c26417_6 ? c26417_3 > c26417_4 ? "below" : "above" : c26417_5 ? "above" : "below";
|
|
return {
|
|
y: (positionY === "above" ? c26417_2 : c26417_1) + (a0 == null ? 0 : a0),
|
|
positionY
|
|
};
|
|
};
|
|
autoPositionVertical.__closure = {
|
|
pageY,
|
|
height: height2,
|
|
CONTEXT_MENU_OFFSET: _ContextMenuConstants_native.CONTEXT_MENU_OFFSET,
|
|
wouldOverflowBelow,
|
|
wouldOverflowAbove,
|
|
availableSpaceBelow,
|
|
availableSpaceAbove,
|
|
positionAboveOffset,
|
|
positionBelowOffset
|
|
};
|
|
autoPositionVertical.__workletHash = 15309589830995;
|
|
autoPositionVertical.__initData = __initData2;
|
|
const autoPositionHorizontal = function autoPositionHorizontal() {
|
|
let r3 = pageX;
|
|
const r5 = r3 - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET;
|
|
const r20 = width - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET - (r3 + _ContextMenuConstants_native.CONTEXT_MENU_MIN_WIDTH);
|
|
let positionX = "left";
|
|
if (r5 > r20) {
|
|
r3 = c26417_7;
|
|
positionX = "right";
|
|
}
|
|
return {
|
|
x: r3,
|
|
positionX
|
|
};
|
|
};
|
|
autoPositionHorizontal.__closure = {
|
|
pageX: pageX3,
|
|
CONTEXT_MENU_EDGE_OFFSET: _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET,
|
|
screenWidth: width,
|
|
CONTEXT_MENU_MIN_WIDTH: _ContextMenuConstants_native.CONTEXT_MENU_MIN_WIDTH,
|
|
minimumRightPosition
|
|
};
|
|
autoPositionHorizontal.__workletHash = 14761866330436;
|
|
autoPositionHorizontal.__initData = __initData3;
|
|
if (c17122_3 === "auto") {
|
|
_ContextMenuConstants_native.CONTEXT_MENU_OFFSET;
|
|
const r216 = wouldOverflowBelow === wouldOverflowAbove ? availableSpaceBelow > availableSpaceAbove ? "below" : "above" : wouldOverflowBelow ? "above" : "below";
|
|
if (r216 === "above") {
|
|
positionBelowOffset = positionAboveOffset;
|
|
}
|
|
const r219 = positionBelowOffset + 0;
|
|
const r225 = r12 - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET;
|
|
const r238 = width - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET - (r12 + _ContextMenuConstants_native.CONTEXT_MENU_MIN_WIDTH);
|
|
let r239 = "left";
|
|
if (r225 > r238) {
|
|
r239 = "right";
|
|
r12 = minimumRightPosition;
|
|
}
|
|
_ReanimatedRexport.runOnJS(callback3)(r12, r219, r239, r216, r73, width2);
|
|
} else {
|
|
const r5 = c17122_3 === "above";
|
|
if (!r5 && c17122_3 !== "below") {
|
|
const r136 = c17122_3 === "left" ? "right" : "left";
|
|
const r143 = r136 === "left" ? r41 + width2 + _ContextMenuConstants_native.CONTEXT_MENU_OFFSET : minimumRightPosition + width2 + _ContextMenuConstants_native.CONTEXT_MENU_OFFSET;
|
|
const r157 = -1 * (_ContextMenuConstants_native.CONTEXT_MENU_OFFSET + r20);
|
|
_ContextMenuConstants_native.CONTEXT_MENU_OFFSET;
|
|
const r163 = wouldOverflowBelow === wouldOverflowAbove ? availableSpaceBelow > availableSpaceAbove ? "below" : "above" : wouldOverflowBelow ? "above" : "below";
|
|
const r32 = (r163 === "above" ? positionAboveOffset : positionBelowOffset) + r157;
|
|
_ReanimatedRexport.runOnJS(callback3)(r143, r32, r136, r163, r73, width2);
|
|
break L47;
|
|
}
|
|
const r174 = r5 ? positionAboveOffset : positionBelowOffset;
|
|
const r180 = r12 - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET;
|
|
const r193 = width - _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET - (r12 + _ContextMenuConstants_native.CONTEXT_MENU_MIN_WIDTH);
|
|
let r194 = "left";
|
|
let r195 = r12;
|
|
if (r180 > r193) {
|
|
r194 = "right";
|
|
r195 = minimumRightPosition;
|
|
}
|
|
_ReanimatedRexport.runOnJS(callback3)(r195, r174, r194, c17122_3, r73, width2);
|
|
}
|
|
}
|
|
};
|
|
V.__closure = {
|
|
_isFabricIOS: isIOS,
|
|
buttonTagSV: sharedValue,
|
|
measureInWindowForFWO: _FWOMeasureUtils.measureInWindowForFWO,
|
|
measure: _ReanimatedRexport.measure,
|
|
buttonRef: buttonRef2,
|
|
title,
|
|
itemCount: length,
|
|
dividerIndexes,
|
|
approximateItemHeight: sharedValue2,
|
|
CONTEXT_MENU_DIVIDER_HEIGHT: _ContextMenuConstants_native.CONTEXT_MENU_DIVIDER_HEIGHT,
|
|
CONTEXT_MENU_OFFSET: _ContextMenuConstants_native.CONTEXT_MENU_OFFSET,
|
|
screenHeight: height,
|
|
CONTEXT_MENU_EDGE_OFFSET: _ContextMenuConstants_native.CONTEXT_MENU_EDGE_OFFSET,
|
|
screenWidth: width,
|
|
CONTEXT_MENU_MIN_WIDTH: _ContextMenuConstants_native.CONTEXT_MENU_MIN_WIDTH,
|
|
menuAlign: align,
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
showMenu: callback3
|
|
};
|
|
V.__workletHash = 6408542373252;
|
|
V.__initData = __initData;
|
|
callback4 = useCallback(V, [buttonRef2, sharedValue, sharedValue2, title, length, height, align, callback3, width, dividerIndexes]);
|
|
const memo2 = useMemo(() => {
|
|
let r51;
|
|
const onPanGestureEnd = function onPanGestureEnd() {
|
|
const r8 = contextMenuState.activeIndex.get();
|
|
_ReanimatedRexport.runOnJS(callback)(r8 === -1);
|
|
};
|
|
onPanGestureEnd.__closure = {
|
|
state: contextMenuState,
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
requestClose: callback
|
|
};
|
|
onPanGestureEnd.__workletHash = 12851223476540;
|
|
onPanGestureEnd.__initData = __initData4;
|
|
if (c17122_1) {
|
|
const r67 = Gesture.Pan();
|
|
const r70 = r67.enabled(c17122_9);
|
|
const i = function i(a0) {
|
|
_ContextMenuState_native.updateContextMenuState(a0.absoluteX, a0.absoluteY, contextMenuState);
|
|
};
|
|
i.__closure = {
|
|
updateContextMenuState: _ContextMenuState_native.updateContextMenuState,
|
|
state: contextMenuState
|
|
};
|
|
i.__workletHash = 2460213213323;
|
|
i.__initData = __initData5;
|
|
const r81 = r70.onUpdate(i).onEnd(onPanGestureEnd);
|
|
const shouldCancelWhenOutside = Gesture.LongPress().enabled(c17122_9).minDuration(CONTEXT_MENU_LONG_PRESS_DURATION_MS).shouldCancelWhenOutside(false);
|
|
const n = function n() {
|
|
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_ContextMenuConstants_native.CONTEXT_MENU_OPEN_HAPTIC);
|
|
callback4();
|
|
};
|
|
n.__closure = {
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
|
|
CONTEXT_MENU_OPEN_HAPTIC: _ContextMenuConstants_native.CONTEXT_MENU_OPEN_HAPTIC,
|
|
measureButtonAndShowMenu: callback4
|
|
};
|
|
n.__workletHash = 13919366908951;
|
|
n.__initData = __initData6;
|
|
return Gesture.Simultaneous(shouldCancelWhenOutside.onStart(n), r81);
|
|
}
|
|
if (c17122_2) {
|
|
const r56 = Gesture.Tap().enabled(c17122_9);
|
|
const r58 = function() {
|
|
callback4();
|
|
};
|
|
r58.__closure = {
|
|
measureButtonAndShowMenu: callback4
|
|
};
|
|
r58.__workletHash = 13410382812897;
|
|
r58.__initData = __initData7;
|
|
r51 = r56.onStart(r58);
|
|
} else {
|
|
const r26 = Gesture.Pan().enabled(c17122_9);
|
|
const t = function t() {
|
|
_ReanimatedRexport.runOnJS(_HapticUtils_native.triggerHapticFeedback)(_ContextMenuConstants_native.CONTEXT_MENU_OPEN_HAPTIC);
|
|
callback4();
|
|
};
|
|
t.__closure = {
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
triggerHapticFeedback: _HapticUtils_native.triggerHapticFeedback,
|
|
CONTEXT_MENU_OPEN_HAPTIC: _ContextMenuConstants_native.CONTEXT_MENU_OPEN_HAPTIC,
|
|
measureButtonAndShowMenu: callback4
|
|
};
|
|
t.__workletHash = 11906156003448;
|
|
t.__initData = __initData9;
|
|
const r40 = r26.onBegin(t);
|
|
const e = function e(a0) {
|
|
_ContextMenuState_native.updateContextMenuState(a0.absoluteX, a0.absoluteY, contextMenuState);
|
|
};
|
|
e.__closure = {
|
|
updateContextMenuState: _ContextMenuState_native.updateContextMenuState,
|
|
state: contextMenuState
|
|
};
|
|
e.__workletHash = 17473642675622;
|
|
e.__initData = __initData8;
|
|
r51 = r40.onUpdate(e).onEnd(onPanGestureEnd);
|
|
}
|
|
return r51;
|
|
}, [triggerOnLongPress, triggerOnTap, callback, enabled, contextMenuState, callback4]);
|
|
const memo3 = useMemo(() => items2.map((item) => ({
|
|
name: item.label,
|
|
label: item.label
|
|
})), [items2]);
|
|
const callback5 = useCallback((c26418_0) => {
|
|
const r7 = items2.find((item) => item.label === c26418_0.nativeEvent.actionName);
|
|
if (r7 != null) {
|
|
const action = r7.action;
|
|
if (action != null) {
|
|
action.call(r7);
|
|
}
|
|
}
|
|
}, [items2]);
|
|
const callback6 = useCallback(() => {
|
|
if (isAndroid() && getIsScreenReaderEnabled()) {
|
|
runOnUI(callback4)();
|
|
}
|
|
}, [callback4]);
|
|
const callback7 = useCallback(() => {
|
|
runOnUI(callback4)();
|
|
}, [callback4]);
|
|
const r162 = {
|
|
ref: buttonRef2,
|
|
onPress: callback6,
|
|
onLongPress: triggerOnLongPress ? disableGesture ? callback7 : void 0 : void 0,
|
|
accessibilityActions: memo3,
|
|
onAccessibilityAction: callback5
|
|
};
|
|
return disableGesture ? <>
|
|
{children(r162)}
|
|
</> : <GestureDetector gesture={memo2}>
|
|
{children(r162)}
|
|
</GestureDetector>;
|
|
}
|