105 lines
3.2 KiB
React
105 lines
3.2 KiB
React
// Metro module 1560 (f1561).
|
|
import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo } from "react";
|
|
import Module1561 from "./Module1561";
|
|
import * as _Module1483 from "./Module1483";
|
|
import { validatePathConfig, BaseNavigationContainer } from "./Module1483";
|
|
import useBackButton from "./useBackButton";
|
|
import useDocumentTitle from "./useDocumentTitle";
|
|
import useLinking from "./useLinking";
|
|
import useThenable from "./useThenable";
|
|
import LinkingContext from "./LinkingContext";
|
|
import ThemeProvider from "./ThemeProvider";
|
|
global.REACT_NAVIGATION_DEVTOOLS = new WeakMap();
|
|
export default forwardRef(function NavigationContainerInner(props, a1) {
|
|
const { theme = Module1561, linking, fallback: _fallback, documentTitle, onReady, ...props2 } = props;
|
|
let c13116_4, ref2;
|
|
let fallback = props.fallback;
|
|
if (fallback === void 0) {
|
|
fallback = null;
|
|
}
|
|
c13116_4 = void 0;
|
|
ref2 = void 0;
|
|
const enabled = !!linking && linking.enabled !== false;
|
|
if (linking?.config) {
|
|
validatePathConfig(linking.config);
|
|
}
|
|
const ref = useRef(null);
|
|
useBackButton(ref);
|
|
useDocumentTitle(ref, documentTitle);
|
|
const getInitialState = useLinking(ref, {
|
|
independent: props2.independent,
|
|
enabled,
|
|
prefixes: [],
|
|
...linking
|
|
}).getInitialState;
|
|
useEffect(() => {
|
|
if (ref.current) {
|
|
const r4 = REACT_NAVIGATION_DEVTOOLS;
|
|
const current = ref.current;
|
|
const r9 = {};
|
|
Object.defineProperty(r9, "linking", {
|
|
get: function() {
|
|
let prefixes = linking?.prefixes;
|
|
if (prefixes == null) {
|
|
prefixes = [];
|
|
}
|
|
let getStateFromPath = linking?.getStateFromPath;
|
|
if (getStateFromPath == null) {
|
|
getStateFromPath = _Module1483.getStateFromPath;
|
|
}
|
|
let getPathFromState = linking?.getPathFromState;
|
|
if (getPathFromState == null) {
|
|
getPathFromState = _Module1483.getPathFromState;
|
|
}
|
|
let getActionFromState = linking?.getActionFromState;
|
|
if (getActionFromState == null) {
|
|
getActionFromState = _Module1483.getActionFromState;
|
|
}
|
|
return {
|
|
...linking,
|
|
enabled,
|
|
prefixes,
|
|
getStateFromPath,
|
|
getPathFromState,
|
|
getActionFromState
|
|
};
|
|
},
|
|
set: void 0,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
r4.set(current, r9);
|
|
}
|
|
});
|
|
let [r62, initialState] = useThenable(getInitialState);
|
|
useImperativeHandle(a1, () => ref.current);
|
|
const memo = useMemo(() => ({
|
|
options: linking
|
|
}), [linking]);
|
|
const r71 = props2.initialState != null || !enabled || r62;
|
|
c13116_4 = r71;
|
|
ref2 = useRef(onReady);
|
|
useEffect(() => {
|
|
ref2.current = onReady;
|
|
});
|
|
useEffect(() => {
|
|
if (c13116_4) {
|
|
const current = ref2.current;
|
|
if (current != null) {
|
|
current.call(ref2);
|
|
}
|
|
}
|
|
}, [r71]);
|
|
if (r71) {
|
|
if (props2.initialState != null) {
|
|
initialState = props2.initialState;
|
|
}
|
|
fallback = <LinkingContext.Provider value={memo}>
|
|
<ThemeProvider value={theme}>
|
|
<BaseNavigationContainer {...props2} initialState={initialState} ref={ref} />
|
|
</ThemeProvider>
|
|
</LinkingContext.Provider>;
|
|
}
|
|
return fallback;
|
|
});
|