decord/source/modules/parent_tools/hooks/useIsOnMainSurface.native.tsx

71 lines
2 KiB
TypeScript
Raw Normal View History

2026-07-27 11:26:19 +00:00
// Module ID: 15750
// Function ID: 121447
2026-07-20 16:05:17 +00:00
// Name: getActiveRoute
2026-07-25 08:10:48 +00:00
// Dependencies: [57, 31, 3983, 2]
2026-07-20 16:05:17 +00:00
// Exports: useIsOnMainSurface
2026-07-27 11:26:19 +00:00
// Module 15750 (getActiveRoute)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import result from "result";
import set from "getRootNavigationRef";
const require = arg1;
2026-07-20 16:05:17 +00:00
function getActiveRoute(routes) {
let index;
if (null != routes) {
if (0 !== routes.routes.length) {
({ index, routes } = routes);
if (null == index) {
index = routes.routes.length - 1;
}
return routes[index];
}
}
}
function getIsOnMainSurface() {
2026-07-25 08:10:48 +00:00
const rootNavigationRef = require(3983) /* getRootNavigationRef */.getRootNavigationRef();
2026-07-20 16:05:17 +00:00
if (null != rootNavigationRef) {
if (rootNavigationRef.isReady()) {
const tmp2 = getActiveRoute(rootNavigationRef.getRootState());
let name;
if (null != tmp2) {
name = tmp2.name;
}
if ("main" !== name) {
return false;
} else {
const tmp5 = getActiveRoute(tmp2.state);
let hasItem = null != tmp5;
if (hasItem) {
hasItem = set.has(tmp5.name);
}
return hasItem;
}
}
}
return false;
}
2026-07-23 10:11:24 +00:00
let set = new Set(["tabs", "channel"]);
let result = set.fileFinishedImporting("modules/parent_tools/hooks/useIsOnMainSurface.native.tsx");
2026-07-20 16:05:17 +00:00
export const useIsOnMainSurface = function useIsOnMainSurface() {
2026-07-23 10:11:24 +00:00
let require;
2026-07-20 16:05:17 +00:00
let tmp2;
2026-07-23 10:11:24 +00:00
[tmp2, require] = callback(React.useState(getIsOnMainSurface), 2);
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
function handleNavigationChange() {
2026-07-23 10:11:24 +00:00
return rootNavigationRef(outer2_6());
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const rootNavigationRef = outer1_0(outer1_1[2]).getRootNavigationRef();
2026-07-20 16:05:17 +00:00
if (null != rootNavigationRef) {
const result = handleNavigationChange();
rootNavigationRef.addListener("state", handleNavigationChange);
return () => {
rootNavigationRef.removeListener("state", handleNavigationChange);
};
}
2026-07-23 10:11:24 +00:00
const obj = outer1_0(outer1_1[2]);
2026-07-20 16:05:17 +00:00
}, []);
return tmp2;
};