Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4824.js (118.4 MB)
76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
// Module ID: 17147
|
|
// Function ID: 17148
|
|
// Name: useIsOnMainSurface
|
|
// Dependencies: [32, 19, 4498, 2]
|
|
// Exports: useIsOnMainSurface
|
|
|
|
// Module 17147 (useIsOnMainSurface)
|
|
import RootNavigationRef from "RootNavigationRef" /* 4498 */;
|
|
import _slicedToArray from "module_32" /* 32 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
require = fn;
|
|
function getIsOnMainSurface() {
|
|
const rootNavigationRef = RootNavigationRef.getRootNavigationRef();
|
|
if (null != rootNavigationRef) {
|
|
if (rootNavigationRef.isReady()) {
|
|
const rootState = rootNavigationRef.getRootState();
|
|
let tmp2;
|
|
if (null != rootState) {
|
|
if (0 !== rootState.routes.length) {
|
|
({ index, routes } = rootState);
|
|
if (index == null) {
|
|
index = rootState.routes.length - 1;
|
|
}
|
|
tmp2 = routes[index];
|
|
}
|
|
}
|
|
let name;
|
|
if (tmp2 != null) {
|
|
name = tmp2.name;
|
|
}
|
|
if ("main" !== name) {
|
|
return false;
|
|
} else {
|
|
const state = tmp2.state;
|
|
let tmp4;
|
|
if (null != state) {
|
|
if (0 !== state.routes.length) {
|
|
({ index: index2, routes: routes2 } = state);
|
|
if (index2 == null) {
|
|
index2 = state.routes.length - 1;
|
|
}
|
|
tmp4 = routes2[index2];
|
|
}
|
|
}
|
|
let hasItem = null != tmp4;
|
|
if (hasItem) {
|
|
hasItem = set.has(tmp4.name);
|
|
}
|
|
return hasItem;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
const set = new Set(["tabs", "channel"]);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/parent_tools/hooks/useIsOnMainSurface.native.tsx");
|
|
|
|
export const useIsOnMainSurface = function useIsOnMainSurface() {
|
|
[tmp2, require] = noop.useState(getIsOnMainSurface);
|
|
const effect = noop.useEffect(() => {
|
|
function handleNavigationChange() {
|
|
return rootNavigationRef(getIsOnMainSurface());
|
|
}
|
|
const rootNavigationRef = RootNavigationRef.getRootNavigationRef();
|
|
if (null != rootNavigationRef) {
|
|
rootNavigationRef(getIsOnMainSurface());
|
|
rootNavigationRef.addListener("state", handleNavigationChange);
|
|
return () => {
|
|
rootNavigationRef.removeListener("state", handleNavigationChange);
|
|
};
|
|
}
|
|
}, []);
|
|
return tmp2;
|
|
};
|