decord/beta/source/modules/routing/native/useBackPressHandler.tsx
github-actions e7a050048e chore: update source for beta 347.7
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4943.js (118.4 MB)
2026-09-21 19:31:18 +00:00

115 lines
3.4 KiB
TypeScript

// Module ID: 5183
// Function ID: 5184
// Name: useBackPressHandler
// Dependencies: [19, 17, 5184, 1368, 558, 568, 2]
// Exports: subscribeToBackPress
// Module 5183 (useBackPressHandler)
import PlatformUtils from "PlatformUtils" /* 1368 */;
import KeyCommands from "KeyCommands" /* 5184 */;
import noop from "module_19" /* 19 */;
const require = globalThis.__r;
require = fn;
get_ActivityIndicator = fn(17);
({ BackHandler: c3, NativeModules: closure_4 } = get_ActivityIndicator);
const ReactCompilerGating = fn(558);
function subscribeToBackPress(onKeyCommand) {
const obj = KeyCommands;
const subscribeKeyCommandResult = obj.subscribeKeyCommand({ input: KeyCommands.KeyInputs.ESCAPE, eventName: "keyCommandBackPress", onKeyCommand });
const 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;
}
const size = fn(2);
const result = size.fileFinishedImporting("modules/routing/native/useBackPressHandler.tsx");
export default ReactCompilerGating.isReactCompilerEnabled() ? ((cResult, arg1) => {
_require = cResult;
cResult = require("c").c(5);
dependencyMap = tmp2;
noop = noop.useRef(cResult);
if (cResult[0] !== cResult) {
let fn = function t() {
closure_2.current = current;
};
cResult[0] = cResult;
cResult[1] = fn;
let tmp3 = fn;
} else {
tmp3 = cResult[1];
}
const layoutEffect = obj2.useLayoutEffect(tmp3);
if (cResult[2] !== (undefined === arg1 || arg1)) {
let fn2 = function c() {
if (closure_1) {
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();
};
}
return fn2;
}
};
const items = [tmp2];
cResult[2] = tmp2;
cResult[3] = fn2;
cResult[4] = items;
let tmp6 = items;
let tmp5 = fn2;
} else {
tmp5 = cResult[3];
tmp6 = cResult[4];
}
const effect = obj2.useEffect(tmp5, tmp6);
}) : ((cResult) => {
const current = cResult;
let flag = arg1;
if (arg1 === undefined) {
flag = true;
}
noop = undefined;
noop = noop.useRef(cResult);
const layoutEffect = noop.useLayoutEffect(() => {
closure_2.current = current;
});
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();
};
}
return fn2;
}
}, items);
});
export { subscribeToBackPress };
export const BackPressHandler = {
minimize() {
MinimizeApp = MinimizeApp.MinimizeApp;
MinimizeApp.minimizeApp();
return true;
}
};