decord/alpha/source/modules/routing/native/useBackPressHandler.tsx

69 lines
2.1 KiB
TypeScript
Raw Normal View History

// Module ID: 5269
// Function ID: 5270
2026-07-20 16:05:17 +00:00
// Name: useBackPressHandler
// Dependencies: [19, 17, 5270, 1364, 2]
// Exports: default, subscribeToBackPress
2026-07-20 16:05:17 +00:00
// Module 5269 (useBackPressHandler)
import PlatformUtils from "PlatformUtils" /* 1364 */;
import KeyCommands from "KeyCommands" /* 5270 */;
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
require = fn;
get_ActivityIndicator = fn(17);
({ BackHandler: c3, NativeModules: closure_4 } = get_ActivityIndicator);
const size = fn(2);
const result = size.fileFinishedImporting("modules/routing/native/useBackPressHandler.tsx");
2026-07-20 16:05:17 +00:00
export default function useBackPressHandler(set) {
const current = set;
2026-07-20 16:05:17 +00:00
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
noop = undefined;
noop = noop.useRef(set);
const layoutEffect = noop.useLayoutEffect(() => {
closure_2.current = current;
2026-07-20 16:05:17 +00:00
});
const items = [flag];
const effect = noop.useEffect(() => {
if (flag) {
const fn = () => ref.current();
const obj2 = { input: KeyCommands.KeyInputs.ESCAPE, eventName: "keyCommandBackPress", onKeyCommand: fn };
let fn2 = KeyCommands.subscribeKeyCommand(obj2);
if (!obj3.isIOS()) {
closure_1 = React3.addEventListener("hardwareBackPress", fn);
fn2 = () => {
closure_1.remove();
fn2();
};
2026-07-20 16:05:17 +00:00
}
return fn2;
2026-07-20 16:05:17 +00:00
}
}, items);
};
export const subscribeToBackPress = function subscribeToBackPress(onKeyCommand) {
const obj = KeyCommands;
const subscribeKeyCommandResult = obj.subscribeKeyCommand({ input: KeyCommands.KeyInputs.ESCAPE, eventName: "keyCommandBackPress", onKeyCommand });
require = subscribeKeyCommandResult;
const obj2 = { input: KeyCommands.KeyInputs.ESCAPE, eventName: "keyCommandBackPress", onKeyCommand };
if (obj3.isIOS()) {
return subscribeKeyCommandResult;
} else {
closure_1 = React3.addEventListener("hardwareBackPress", onKeyCommand);
return () => {
closure_1.remove();
fn2();
};
}
obj3 = PlatformUtils;
};
2026-07-23 10:11:24 +00:00
export const BackPressHandler = {
minimize() {
MinimizeApp = MinimizeApp.MinimizeApp;
MinimizeApp.minimizeApp();
return true;
}
};