decord/source/1535_context.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-08-15 05:55:55 +00:00
// Module ID: 1535
// Function ID: 1536
2026-07-20 16:05:17 +00:00
// Name: context
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 21]
2026-08-06 08:05:19 +00:00
// Exports: EnsureSingleNavigator
2026-07-20 16:05:17 +00:00
2026-08-15 05:55:55 +00:00
// Module 1535 (context)
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import { jsx } from "jsxProd" /* 21 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c0 = importAllResult;
2026-07-20 16:05:17 +00:00
const context = importAllResult.createContext(undefined);
2026-08-06 08:05:19 +00:00
export const SingleNavigatorContext = context;
export const EnsureSingleNavigator = function EnsureSingleNavigator(children) {
2026-08-24 06:08:38 +00:00
importAllResult = undefined;
2026-08-06 08:05:19 +00:00
importAllResult = importAllResult.useRef(undefined);
2026-07-23 10:11:24 +00:00
return <context.Provider value={importAllResult.useMemo(() => ({
2026-07-20 16:05:17 +00:00
register(current) {
2026-07-29 08:29:29 +00:00
current = ref.current;
2026-07-20 16:05:17 +00:00
if (undefined !== current) {
if (current !== current) {
const _Error = Error;
2026-08-24 06:08:38 +00:00
error = 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.");
2026-07-20 16:05:17 +00:00
throw error;
}
}
2026-07-29 08:29:29 +00:00
ref.current = current;
2026-07-20 16:05:17 +00:00
},
unregister(arg0) {
2026-07-29 08:29:29 +00:00
if (arg0 === ref.current) {
tmp.current = undefined;
2026-07-20 16:05:17 +00:00
}
}
}), [])}>{arg0.children}</context.Provider>;
};