decord/source/design/components/Menu/native/MenuPopout.tsx

102 lines
3.1 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13590
// Function ID: 13591
2026-07-20 16:05:17 +00:00
// Name: MenuPopout
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 19, 21, 8748, 4120, 10174, 13587, 13588, 13589, 2]
2026-07-20 16:05:17 +00:00
// Exports: MenuPopout
2026-08-25 06:04:03 +00:00
// Module 13590 (MenuPopout)
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
import jsxProd from "jsxProd" /* 21 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
({ jsx: c5, Fragment: closure_6 } = jsxProd);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("design/components/Menu/native/MenuPopout.tsx");
2026-07-20 16:05:17 +00:00
export const MenuPopout = function MenuPopout(onRequestOpen) {
({ key, menuItems } = onRequestOpen);
if (menuItems === undefined) {
menuItems = [];
}
onRequestOpen = onRequestOpen.onRequestOpen;
const onRequestClose = onRequestOpen.onRequestClose;
const position = onRequestOpen.position;
const align = onRequestOpen.align;
const offset = onRequestOpen.offset;
const offsetAnimated = onRequestOpen.offsetAnimated;
2026-07-29 08:29:29 +00:00
key = undefined;
2026-07-20 16:05:17 +00:00
let animatedRef;
let first;
2026-08-24 06:08:38 +00:00
closure_10 = undefined;
2026-07-23 10:11:24 +00:00
let callback;
2026-07-20 16:05:17 +00:00
let memo;
let callback1;
2026-07-23 10:11:24 +00:00
let obj = menuItems(onRequestClose[3]);
2026-07-29 08:29:29 +00:00
if (key == null) {
key = obj.useUID();
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
animatedRef = menuItems(onRequestClose[4]).useAnimatedRef();
2026-07-29 08:29:29 +00:00
const tmp4 = position(align.useState(false), 2);
first = tmp4[0];
closure_10 = tmp4[1];
const items = [key, onRequestClose];
2026-07-20 16:05:17 +00:00
const mapped = menuItems.map((label) => ({ name: label.label, label: label.label }));
2026-07-23 10:11:24 +00:00
callback = align.useCallback(() => {
2026-07-20 16:05:17 +00:00
callback(false);
2026-07-29 08:29:29 +00:00
if (onRequestClose != null) {
2026-07-20 16:05:17 +00:00
onRequestClose();
}
2026-07-29 08:29:29 +00:00
onRequestOpen(onRequestClose[5]).hideNativeMenu(key);
2026-07-20 16:05:17 +00:00
}, items);
const items1 = [animatedRef, callback, menuItems, position, align, offset, offsetAnimated];
2026-08-24 06:08:38 +00:00
memo = align.useMemo(() => offset(menuItems(onRequestClose[6]).Menu, {
toggleButtonRef: animatedRef,
onClose: callback,
position,
align,
offset,
offsetAnimated,
children: menuItems.map((arg0, arg1) => {
2026-07-29 08:29:29 +00:00
let obj = { children: null };
obj = { showIconFirst: true };
const merged = Object.assign(arg0);
2026-08-25 06:04:03 +00:00
obj[0] = callback2(callback(13589).MenuItem, obj);
return callback2(callback(13588).MenuGroup, obj, "chat-context-menu-group-" + arg1);
2026-08-24 06:08:38 +00:00
})
}), items1);
2026-07-29 08:29:29 +00:00
const items2 = [memo, key, onRequestOpen];
2026-07-23 10:11:24 +00:00
callback1 = align.useCallback(() => {
2026-07-20 16:05:17 +00:00
callback(true);
2026-07-29 08:29:29 +00:00
if (onRequestOpen != null) {
2026-07-20 16:05:17 +00:00
onRequestOpen();
}
2026-07-29 08:29:29 +00:00
onRequestOpen(onRequestClose[5]).showNativeMenu(key, memo);
2026-07-20 16:05:17 +00:00
}, items2);
const items3 = [first, callback, callback1];
2026-07-29 08:29:29 +00:00
obj = { children: null };
2026-07-20 16:05:17 +00:00
obj = {
ref: animatedRef,
2026-07-23 10:11:24 +00:00
onPress: align.useCallback(() => {
2026-07-20 16:05:17 +00:00
if (first) {
callback();
} else {
callback1();
}
}, items3),
accessibilityState: { expanded: first },
accessibilityActions: mapped,
onAccessibilityAction(arg0) {
2026-08-24 06:08:38 +00:00
menuItems = arg0;
2026-07-23 10:11:24 +00:00
const found = menuItems.find((label) => label.label === nativeEvent.nativeEvent.actionName);
2026-07-29 08:29:29 +00:00
if (found != null) {
const action = found.action;
if (action != null) {
action();
}
2026-07-20 16:05:17 +00:00
}
}
};
2026-07-29 08:29:29 +00:00
obj[0] = onRequestOpen.children(obj, { isShown: first });
2026-07-20 16:05:17 +00:00
return offset(offsetAnimated, obj);
};