decord/source/1553_useFocusEffect.js

58 lines
1.6 KiB
JavaScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 1553
// Function ID: 1554
2026-07-20 16:05:17 +00:00
// Name: useFocusEffect
2026-08-06 08:05:19 +00:00
// Dependencies: [19, 1523]
// Exports: useFocusEffect
2026-07-20 16:05:17 +00:00
2026-08-06 08:05:19 +00:00
// Module 1553 (useFocusEffect)
2026-07-29 08:29:29 +00:00
import noop from "noop";
2026-07-20 16:05:17 +00:00
2026-08-06 08:05:19 +00:00
const require = arg1;
2026-07-21 22:01:30 +00:00
2026-08-06 08:05:19 +00:00
export const useFocusEffect = function useFocusEffect(c5) {
const _require = c5;
navigation = _require(navigation[1]).useNavigation();
2026-07-20 16:05:17 +00:00
if (undefined !== arguments[1]) {
const _console = console;
console.error("You passed a second argument to 'useFocusEffect', but it only accepts one argument. If you want to pass a dependency array, you can use 'React.useCallback':\n\nuseFocusEffect(\n React.useCallback(() => {\n // Your code here\n }, [depA, depB])\n);\n\nSee usage guide: https://reactnavigation.org/docs/use-focus-effect");
}
2026-08-06 08:05:19 +00:00
const items = [c5, navigation];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-08-06 08:05:19 +00:00
let navigation = false;
if (navigation.isFocused()) {
2026-07-29 08:29:29 +00:00
const tmp2 = c5();
if (undefined === tmp2) {
let tmp3 = tmp2;
}
c5 = tmp3;
2026-08-06 08:05:19 +00:00
navigation = true;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let noop = obj.addListener("focus", () => {
2026-07-23 10:11:24 +00:00
if (!c1) {
2026-07-29 08:29:29 +00:00
if (undefined !== tmp3) {
tmp3();
}
tmp3 = tmp3();
if (undefined === tmp3) {
const tmp4 = tmp3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp3 = tmp4;
2026-07-23 10:11:24 +00:00
c1 = true;
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
let closure_3 = obj.addListener("blur", () => {
if (undefined !== tmp3) {
tmp3();
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = false;
2026-07-20 16:05:17 +00:00
});
return () => {
2026-07-29 08:29:29 +00:00
if (undefined !== tmp3) {
tmp3();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback();
tmp3 = callback2();
2026-07-20 16:05:17 +00:00
};
}, items);
};