Files
discord-decomp/_bundle/EnsureSingleNavigator.jsx
T
2026-11-01 12:12:55 +02:00

23 lines
956 B
React

// Metro module 1506 (f1507).
import { createContext, useRef, useMemo } from "react";
const context = createContext(void 0);
export default function EnsureSingleNavigator(props) {
const children = props.children;
const ref = useRef();
return <context.Provider value={useMemo(() => ({
register: (a0) => {
const current = ref.current;
if (current !== void 0 && a0 !== current) {
throw new Error("Another navigator is already registered for this container. You likely have multiple navigators under a single \"NavigationContainer\" or \"Screen\". Make sure each navigator is under a separate \"Screen\" container. See https://reactnavigation.org/docs/nesting-navigators for a guide on nesting.");
}
ref.current = a0;
},
unregister: (a0) => {
if (a0 === ref.current) {
ref.current = void 0;
}
}
}), [])}>{children}</context.Provider>;
};
export { context as SingleNavigatorContext };