@react-navigation/core 6.4.4 → 6.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/BaseNavigationContainer.js +17 -69
- package/lib/commonjs/BaseNavigationContainer.js.map +1 -1
- package/lib/commonjs/CurrentRenderContext.js +0 -4
- package/lib/commonjs/CurrentRenderContext.js.map +1 -1
- package/lib/commonjs/EnsureSingleNavigator.js +1 -12
- package/lib/commonjs/EnsureSingleNavigator.js.map +1 -1
- package/lib/commonjs/Group.js +0 -1
- package/lib/commonjs/Group.js.map +1 -1
- package/lib/commonjs/NavigationBuilderContext.js +0 -4
- package/lib/commonjs/NavigationBuilderContext.js.map +1 -1
- package/lib/commonjs/NavigationContainerRefContext.js +0 -4
- package/lib/commonjs/NavigationContainerRefContext.js.map +1 -1
- package/lib/commonjs/NavigationContext.js +0 -4
- package/lib/commonjs/NavigationContext.js.map +1 -1
- package/lib/commonjs/NavigationHelpersContext.js +0 -4
- package/lib/commonjs/NavigationHelpersContext.js.map +1 -1
- package/lib/commonjs/NavigationRouteContext.js +0 -4
- package/lib/commonjs/NavigationRouteContext.js.map +1 -1
- package/lib/commonjs/NavigationStateContext.js +0 -12
- package/lib/commonjs/NavigationStateContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveContext.js +0 -4
- package/lib/commonjs/PreventRemoveContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveProvider.js +3 -21
- package/lib/commonjs/PreventRemoveProvider.js.map +1 -1
- package/lib/commonjs/SceneView.js +8 -13
- package/lib/commonjs/SceneView.js.map +1 -1
- package/lib/commonjs/Screen.js +0 -1
- package/lib/commonjs/Screen.js.map +1 -1
- package/lib/commonjs/StaticContainer.js +0 -10
- package/lib/commonjs/StaticContainer.js.map +1 -1
- package/lib/commonjs/UnhandledActionContext.js +0 -4
- package/lib/commonjs/UnhandledActionContext.js.map +1 -1
- package/lib/commonjs/checkDuplicateRouteNames.js +0 -5
- package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -1
- package/lib/commonjs/checkSerializable.js +0 -9
- package/lib/commonjs/checkSerializable.js.map +1 -1
- package/lib/commonjs/createNavigationContainerRef.js +0 -13
- package/lib/commonjs/createNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/createNavigatorFactory.js +0 -5
- package/lib/commonjs/createNavigatorFactory.js.map +1 -1
- package/lib/commonjs/findFocusedRoute.js +5 -10
- package/lib/commonjs/findFocusedRoute.js.map +1 -1
- package/lib/commonjs/fromEntries.js +0 -3
- package/lib/commonjs/fromEntries.js.map +1 -1
- package/lib/commonjs/getActionFromState.js +11 -22
- package/lib/commonjs/getActionFromState.js.map +1 -1
- package/lib/commonjs/getFocusedRouteNameFromRoute.js +7 -8
- package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/commonjs/getPathFromState.js +25 -55
- package/lib/commonjs/getPathFromState.js.map +1 -1
- package/lib/commonjs/getStateFromPath.js +48 -105
- package/lib/commonjs/getStateFromPath.js.map +1 -1
- package/lib/commonjs/index.js +0 -30
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/isArrayEqual.js +0 -3
- package/lib/commonjs/isArrayEqual.js.map +1 -1
- package/lib/commonjs/isRecordEqual.js +0 -4
- package/lib/commonjs/isRecordEqual.js.map +1 -1
- package/lib/commonjs/types.js +3 -5
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useChildListeners.js +0 -5
- package/lib/commonjs/useChildListeners.js.map +1 -1
- package/lib/commonjs/useComponent.js +3 -9
- package/lib/commonjs/useComponent.js.map +1 -1
- package/lib/commonjs/useCurrentRender.js +0 -7
- package/lib/commonjs/useCurrentRender.js.map +1 -1
- package/lib/commonjs/useDescriptors.js +11 -21
- package/lib/commonjs/useDescriptors.js.map +1 -1
- package/lib/commonjs/useEventEmitter.js +2 -24
- package/lib/commonjs/useEventEmitter.js.map +1 -1
- package/lib/commonjs/useFocusEffect.js +2 -20
- package/lib/commonjs/useFocusEffect.js.map +1 -1
- package/lib/commonjs/useFocusEvents.js +9 -15
- package/lib/commonjs/useFocusEvents.js.map +1 -1
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js +0 -8
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/commonjs/useIsFocused.js +0 -8
- package/lib/commonjs/useIsFocused.js.map +1 -1
- package/lib/commonjs/useKeyedChildListeners.js +0 -4
- package/lib/commonjs/useKeyedChildListeners.js.map +1 -1
- package/lib/commonjs/useNavigation.js +3 -11
- package/lib/commonjs/useNavigation.js.map +1 -1
- package/lib/commonjs/useNavigationBuilder.js +34 -91
- package/lib/commonjs/useNavigationBuilder.js.map +1 -1
- package/lib/commonjs/useNavigationCache.js +18 -30
- package/lib/commonjs/useNavigationCache.js.map +1 -1
- package/lib/commonjs/useNavigationContainerRef.js +0 -8
- package/lib/commonjs/useNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/useNavigationHelpers.js +4 -18
- package/lib/commonjs/useNavigationHelpers.js.map +1 -1
- package/lib/commonjs/useNavigationState.js +5 -9
- package/lib/commonjs/useNavigationState.js.map +1 -1
- package/lib/commonjs/useOnAction.js +8 -25
- package/lib/commonjs/useOnAction.js.map +1 -1
- package/lib/commonjs/useOnGetState.js +6 -16
- package/lib/commonjs/useOnGetState.js.map +1 -1
- package/lib/commonjs/useOnPreventRemove.js +9 -24
- package/lib/commonjs/useOnPreventRemove.js.map +1 -1
- package/lib/commonjs/useOnRouteFocus.js +0 -8
- package/lib/commonjs/useOnRouteFocus.js.map +1 -1
- package/lib/commonjs/useOptionsGetters.js +5 -24
- package/lib/commonjs/useOptionsGetters.js.map +1 -1
- package/lib/commonjs/usePreventRemove.js +0 -11
- package/lib/commonjs/usePreventRemove.js.map +1 -1
- package/lib/commonjs/usePreventRemoveContext.js +0 -8
- package/lib/commonjs/usePreventRemoveContext.js.map +1 -1
- package/lib/commonjs/useRegisterNavigator.js +0 -8
- package/lib/commonjs/useRegisterNavigator.js.map +1 -1
- package/lib/commonjs/useRoute.js +0 -8
- package/lib/commonjs/useRoute.js.map +1 -1
- package/lib/commonjs/useRouteCache.js +1 -10
- package/lib/commonjs/useRouteCache.js.map +1 -1
- package/lib/commonjs/useScheduleUpdate.js +1 -8
- package/lib/commonjs/useScheduleUpdate.js.map +1 -1
- package/lib/commonjs/useSyncState.js +9 -17
- package/lib/commonjs/useSyncState.js.map +1 -1
- package/lib/commonjs/validatePathConfig.js +0 -7
- package/lib/commonjs/validatePathConfig.js.map +1 -1
- package/lib/module/BaseNavigationContainer.js +17 -46
- package/lib/module/BaseNavigationContainer.js.map +1 -1
- package/lib/module/CurrentRenderContext.js +1 -1
- package/lib/module/CurrentRenderContext.js.map +1 -1
- package/lib/module/EnsureSingleNavigator.js +1 -7
- package/lib/module/EnsureSingleNavigator.js.map +1 -1
- package/lib/module/Group.js.map +1 -1
- package/lib/module/NavigationBuilderContext.js +0 -1
- package/lib/module/NavigationBuilderContext.js.map +1 -1
- package/lib/module/NavigationContainerRefContext.js +0 -1
- package/lib/module/NavigationContainerRefContext.js.map +1 -1
- package/lib/module/NavigationContext.js +0 -1
- package/lib/module/NavigationContext.js.map +1 -1
- package/lib/module/NavigationHelpersContext.js +0 -1
- package/lib/module/NavigationHelpersContext.js.map +1 -1
- package/lib/module/NavigationRouteContext.js +1 -1
- package/lib/module/NavigationRouteContext.js.map +1 -1
- package/lib/module/NavigationStateContext.js +0 -6
- package/lib/module/NavigationStateContext.js.map +1 -1
- package/lib/module/PreventRemoveContext.js +1 -0
- package/lib/module/PreventRemoveContext.js.map +1 -1
- package/lib/module/PreventRemoveProvider.js +3 -12
- package/lib/module/PreventRemoveProvider.js.map +1 -1
- package/lib/module/SceneView.js +8 -5
- package/lib/module/SceneView.js.map +1 -1
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/StaticContainer.js +1 -6
- package/lib/module/StaticContainer.js.map +1 -1
- package/lib/module/UnhandledActionContext.js.map +1 -1
- package/lib/module/checkDuplicateRouteNames.js +0 -4
- package/lib/module/checkDuplicateRouteNames.js.map +1 -1
- package/lib/module/checkSerializable.js +0 -8
- package/lib/module/checkSerializable.js.map +1 -1
- package/lib/module/createNavigationContainerRef.js +0 -10
- package/lib/module/createNavigationContainerRef.js.map +1 -1
- package/lib/module/createNavigatorFactory.js +0 -2
- package/lib/module/createNavigatorFactory.js.map +1 -1
- package/lib/module/findFocusedRoute.js +5 -9
- package/lib/module/findFocusedRoute.js.map +1 -1
- package/lib/module/fromEntries.js +0 -2
- package/lib/module/fromEntries.js.map +1 -1
- package/lib/module/getActionFromState.js +11 -21
- package/lib/module/getActionFromState.js.map +1 -1
- package/lib/module/getFocusedRouteNameFromRoute.js +7 -6
- package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/module/getPathFromState.js +25 -49
- package/lib/module/getPathFromState.js.map +1 -1
- package/lib/module/getStateFromPath.js +48 -98
- package/lib/module/getStateFromPath.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/isArrayEqual.js +0 -2
- package/lib/module/isArrayEqual.js.map +1 -1
- package/lib/module/isRecordEqual.js +0 -3
- package/lib/module/isRecordEqual.js.map +1 -1
- package/lib/module/types.js +3 -3
- package/lib/module/types.js.map +1 -1
- package/lib/module/useChildListeners.js +0 -2
- package/lib/module/useChildListeners.js.map +1 -1
- package/lib/module/useComponent.js +3 -6
- package/lib/module/useComponent.js.map +1 -1
- package/lib/module/useCurrentRender.js +0 -2
- package/lib/module/useCurrentRender.js.map +1 -1
- package/lib/module/useDescriptors.js +11 -11
- package/lib/module/useDescriptors.js.map +1 -1
- package/lib/module/useEventEmitter.js +2 -21
- package/lib/module/useEventEmitter.js.map +1 -1
- package/lib/module/useFocusEffect.js +2 -15
- package/lib/module/useFocusEffect.js.map +1 -1
- package/lib/module/useFocusEvents.js +9 -10
- package/lib/module/useFocusEvents.js.map +1 -1
- package/lib/module/useFocusedListenersChildrenAdapter.js +0 -3
- package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/module/useIsFocused.js +1 -3
- package/lib/module/useIsFocused.js.map +1 -1
- package/lib/module/useKeyedChildListeners.js +0 -1
- package/lib/module/useKeyedChildListeners.js.map +1 -1
- package/lib/module/useNavigation.js +3 -5
- package/lib/module/useNavigation.js.map +1 -1
- package/lib/module/useNavigationBuilder.js +37 -63
- package/lib/module/useNavigationBuilder.js.map +1 -1
- package/lib/module/useNavigationCache.js +18 -24
- package/lib/module/useNavigationCache.js.map +1 -1
- package/lib/module/useNavigationContainerRef.js +0 -2
- package/lib/module/useNavigationContainerRef.js.map +1 -1
- package/lib/module/useNavigationHelpers.js +4 -9
- package/lib/module/useNavigationHelpers.js.map +1 -1
- package/lib/module/useNavigationState.js +5 -4
- package/lib/module/useNavigationState.js.map +1 -1
- package/lib/module/useOnAction.js +8 -19
- package/lib/module/useOnAction.js.map +1 -1
- package/lib/module/useOnGetState.js +6 -8
- package/lib/module/useOnGetState.js.map +1 -1
- package/lib/module/useOnPreventRemove.js +9 -14
- package/lib/module/useOnPreventRemove.js.map +1 -1
- package/lib/module/useOnRouteFocus.js +0 -3
- package/lib/module/useOnRouteFocus.js.map +1 -1
- package/lib/module/useOptionsGetters.js +5 -17
- package/lib/module/useOptionsGetters.js.map +1 -1
- package/lib/module/usePreventRemove.js +1 -2
- package/lib/module/usePreventRemove.js.map +1 -1
- package/lib/module/usePreventRemoveContext.js +0 -2
- package/lib/module/usePreventRemoveContext.js.map +1 -1
- package/lib/module/useRegisterNavigator.js +1 -3
- package/lib/module/useRegisterNavigator.js.map +1 -1
- package/lib/module/useRoute.js +0 -3
- package/lib/module/useRoute.js.map +1 -1
- package/lib/module/useRouteCache.js +1 -6
- package/lib/module/useRouteCache.js.map +1 -1
- package/lib/module/useScheduleUpdate.js +1 -3
- package/lib/module/useScheduleUpdate.js.map +1 -1
- package/lib/module/useSyncState.js +9 -13
- package/lib/module/useSyncState.js.map +1 -1
- package/lib/module/validatePathConfig.js +0 -6
- package/lib/module/validatePathConfig.js.map +1 -1
- package/lib/typescript/src/BaseNavigationContainer.d.ts +1 -0
- package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -0
- package/lib/typescript/src/CurrentRenderContext.d.ts +1 -0
- package/lib/typescript/src/CurrentRenderContext.d.ts.map +1 -0
- package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -0
- package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -0
- package/lib/typescript/src/Group.d.ts +1 -0
- package/lib/typescript/src/Group.d.ts.map +1 -0
- package/lib/typescript/src/NavigationBuilderContext.d.ts +1 -0
- package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationContainerRefContext.d.ts +1 -0
- package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationContext.d.ts +1 -0
- package/lib/typescript/src/NavigationContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -0
- package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationRouteContext.d.ts +1 -0
- package/lib/typescript/src/NavigationRouteContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationStateContext.d.ts +1 -0
- package/lib/typescript/src/NavigationStateContext.d.ts.map +1 -0
- package/lib/typescript/src/PreventRemoveContext.d.ts +1 -0
- package/lib/typescript/src/PreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -0
- package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -0
- package/lib/typescript/src/SceneView.d.ts +1 -0
- package/lib/typescript/src/SceneView.d.ts.map +1 -0
- package/lib/typescript/src/Screen.d.ts +1 -0
- package/lib/typescript/src/Screen.d.ts.map +1 -0
- package/lib/typescript/src/StaticContainer.d.ts +1 -0
- package/lib/typescript/src/StaticContainer.d.ts.map +1 -0
- package/lib/typescript/src/UnhandledActionContext.d.ts +1 -0
- package/lib/typescript/src/UnhandledActionContext.d.ts.map +1 -0
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts +1 -0
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts.map +1 -0
- package/lib/typescript/src/checkSerializable.d.ts +1 -0
- package/lib/typescript/src/checkSerializable.d.ts.map +1 -0
- package/lib/typescript/src/createNavigationContainerRef.d.ts +1 -0
- package/lib/typescript/src/createNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/src/createNavigatorFactory.d.ts +1 -0
- package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -0
- package/lib/typescript/src/findFocusedRoute.d.ts +1 -0
- package/lib/typescript/src/findFocusedRoute.d.ts.map +1 -0
- package/lib/typescript/src/fromEntries.d.ts +1 -0
- package/lib/typescript/src/fromEntries.d.ts.map +1 -0
- package/lib/typescript/src/getActionFromState.d.ts +1 -0
- package/lib/typescript/src/getActionFromState.d.ts.map +1 -0
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts +1 -0
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts.map +1 -0
- package/lib/typescript/src/getPathFromState.d.ts +1 -0
- package/lib/typescript/src/getPathFromState.d.ts.map +1 -0
- package/lib/typescript/src/getStateFromPath.d.ts +1 -0
- package/lib/typescript/src/getStateFromPath.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/isArrayEqual.d.ts +1 -0
- package/lib/typescript/src/isArrayEqual.d.ts.map +1 -0
- package/lib/typescript/src/isRecordEqual.d.ts +1 -0
- package/lib/typescript/src/isRecordEqual.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +1 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/useChildListeners.d.ts +1 -0
- package/lib/typescript/src/useChildListeners.d.ts.map +1 -0
- package/lib/typescript/src/useComponent.d.ts +1 -0
- package/lib/typescript/src/useComponent.d.ts.map +1 -0
- package/lib/typescript/src/useCurrentRender.d.ts +1 -0
- package/lib/typescript/src/useCurrentRender.d.ts.map +1 -0
- package/lib/typescript/src/useDescriptors.d.ts +1 -0
- package/lib/typescript/src/useDescriptors.d.ts.map +1 -0
- package/lib/typescript/src/useEventEmitter.d.ts +1 -0
- package/lib/typescript/src/useEventEmitter.d.ts.map +1 -0
- package/lib/typescript/src/useFocusEffect.d.ts +1 -0
- package/lib/typescript/src/useFocusEffect.d.ts.map +1 -0
- package/lib/typescript/src/useFocusEvents.d.ts +1 -0
- package/lib/typescript/src/useFocusEvents.d.ts.map +1 -0
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +1 -0
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -0
- package/lib/typescript/src/useIsFocused.d.ts +1 -0
- package/lib/typescript/src/useIsFocused.d.ts.map +1 -0
- package/lib/typescript/src/useKeyedChildListeners.d.ts +1 -0
- package/lib/typescript/src/useKeyedChildListeners.d.ts.map +1 -0
- package/lib/typescript/src/useNavigation.d.ts +1 -0
- package/lib/typescript/src/useNavigation.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationBuilder.d.ts +1 -0
- package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationCache.d.ts +1 -0
- package/lib/typescript/src/useNavigationCache.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationContainerRef.d.ts +1 -0
- package/lib/typescript/src/useNavigationContainerRef.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationHelpers.d.ts +1 -0
- package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -0
- package/lib/typescript/src/useNavigationState.d.ts +1 -0
- package/lib/typescript/src/useNavigationState.d.ts.map +1 -0
- package/lib/typescript/src/useOnAction.d.ts +1 -0
- package/lib/typescript/src/useOnAction.d.ts.map +1 -0
- package/lib/typescript/src/useOnGetState.d.ts +1 -0
- package/lib/typescript/src/useOnGetState.d.ts.map +1 -0
- package/lib/typescript/src/useOnPreventRemove.d.ts +1 -0
- package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -0
- package/lib/typescript/src/useOnRouteFocus.d.ts +1 -0
- package/lib/typescript/src/useOnRouteFocus.d.ts.map +1 -0
- package/lib/typescript/src/useOptionsGetters.d.ts +1 -0
- package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -0
- package/lib/typescript/src/usePreventRemove.d.ts +1 -0
- package/lib/typescript/src/usePreventRemove.d.ts.map +1 -0
- package/lib/typescript/src/usePreventRemoveContext.d.ts +1 -0
- package/lib/typescript/src/usePreventRemoveContext.d.ts.map +1 -0
- package/lib/typescript/src/useRegisterNavigator.d.ts +1 -0
- package/lib/typescript/src/useRegisterNavigator.d.ts.map +1 -0
- package/lib/typescript/src/useRoute.d.ts +1 -0
- package/lib/typescript/src/useRoute.d.ts.map +1 -0
- package/lib/typescript/src/useRouteCache.d.ts +1 -0
- package/lib/typescript/src/useRouteCache.d.ts.map +1 -0
- package/lib/typescript/src/useScheduleUpdate.d.ts +1 -0
- package/lib/typescript/src/useScheduleUpdate.d.ts.map +1 -0
- package/lib/typescript/src/useSyncState.d.ts +1 -0
- package/lib/typescript/src/useSyncState.d.ts.map +1 -0
- package/lib/typescript/src/validatePathConfig.d.ts +1 -0
- package/lib/typescript/src/validatePathConfig.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -5,48 +5,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = useOnPreventRemove;
|
|
7
7
|
exports.shouldPreventRemove = void 0;
|
|
8
|
-
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
var _NavigationBuilderContext = _interopRequireDefault(require("./NavigationBuilderContext"));
|
|
12
|
-
|
|
13
10
|
var _NavigationRouteContext = _interopRequireDefault(require("./NavigationRouteContext"));
|
|
14
|
-
|
|
15
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
-
|
|
19
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
|
|
21
14
|
const VISITED_ROUTE_KEYS = Symbol('VISITED_ROUTE_KEYS');
|
|
22
|
-
|
|
23
15
|
const shouldPreventRemove = (emitter, beforeRemoveListeners, currentRoutes, nextRoutes, action) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const nextRouteKeys = nextRoutes.map(route => route.key); // Call these in reverse order so last screens handle the event first
|
|
16
|
+
const nextRouteKeys = nextRoutes.map(route => route.key);
|
|
27
17
|
|
|
18
|
+
// Call these in reverse order so last screens handle the event first
|
|
28
19
|
const removedRoutes = currentRoutes.filter(route => !nextRouteKeys.includes(route.key)).reverse();
|
|
29
|
-
const visitedRouteKeys =
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
const visitedRouteKeys =
|
|
21
|
+
// @ts-expect-error: add this property to mark that we've already emitted this action
|
|
22
|
+
action[VISITED_ROUTE_KEYS] ?? new Set();
|
|
23
|
+
const beforeRemoveAction = {
|
|
24
|
+
...action,
|
|
32
25
|
[VISITED_ROUTE_KEYS]: visitedRouteKeys
|
|
33
26
|
};
|
|
34
|
-
|
|
35
27
|
for (const route of removedRoutes) {
|
|
36
28
|
var _beforeRemoveListener;
|
|
37
|
-
|
|
38
29
|
if (visitedRouteKeys.has(route.key)) {
|
|
39
30
|
// Skip if we've already emitted this action for this screen
|
|
40
31
|
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
32
|
+
}
|
|
43
33
|
|
|
34
|
+
// First, we need to check if any child screens want to prevent it
|
|
44
35
|
const isPrevented = (_beforeRemoveListener = beforeRemoveListeners[route.key]) === null || _beforeRemoveListener === void 0 ? void 0 : _beforeRemoveListener.call(beforeRemoveListeners, beforeRemoveAction);
|
|
45
|
-
|
|
46
36
|
if (isPrevented) {
|
|
47
37
|
return true;
|
|
48
38
|
}
|
|
49
|
-
|
|
50
39
|
visitedRouteKeys.add(route.key);
|
|
51
40
|
const event = emitter.emit({
|
|
52
41
|
type: 'beforeRemove',
|
|
@@ -56,17 +45,13 @@ const shouldPreventRemove = (emitter, beforeRemoveListeners, currentRoutes, next
|
|
|
56
45
|
},
|
|
57
46
|
canPreventDefault: true
|
|
58
47
|
});
|
|
59
|
-
|
|
60
48
|
if (event.defaultPrevented) {
|
|
61
49
|
return true;
|
|
62
50
|
}
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
return false;
|
|
66
53
|
};
|
|
67
|
-
|
|
68
54
|
exports.shouldPreventRemove = shouldPreventRemove;
|
|
69
|
-
|
|
70
55
|
function useOnPreventRemove(_ref) {
|
|
71
56
|
let {
|
|
72
57
|
getState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VISITED_ROUTE_KEYS","Symbol","shouldPreventRemove","emitter","beforeRemoveListeners","currentRoutes","nextRoutes","action","nextRouteKeys","map","route","key","removedRoutes","filter","includes","reverse","visitedRouteKeys","Set","beforeRemoveAction","has","isPrevented","add","event","emit","type","target","data","canPreventDefault","defaultPrevented","useOnPreventRemove","getState","addKeyedListener","React","useContext","NavigationBuilderContext","NavigationRouteContext","routeKey","useEffect","state","routes"],"
|
|
1
|
+
{"version":3,"names":["VISITED_ROUTE_KEYS","Symbol","shouldPreventRemove","emitter","beforeRemoveListeners","currentRoutes","nextRoutes","action","nextRouteKeys","map","route","key","removedRoutes","filter","includes","reverse","visitedRouteKeys","Set","beforeRemoveAction","has","isPrevented","add","event","emit","type","target","data","canPreventDefault","defaultPrevented","useOnPreventRemove","getState","addKeyedListener","React","useContext","NavigationBuilderContext","NavigationRouteContext","routeKey","useEffect","state","routes"],"sourceRoot":"../../src","sources":["useOnPreventRemove.tsx"],"mappings":";;;;;;;AAIA;AAEA;AAGA;AAA8D;AAAA;AAAA;AAU9D,MAAMA,kBAAkB,GAAGC,MAAM,CAAC,oBAAoB,CAAC;AAEhD,MAAMC,mBAAmB,GAAG,CACjCC,OAAkD,EAClDC,qBAA4E,EAC5EC,aAAgC,EAChCC,UAA0C,EAC1CC,MAAwB,KACrB;EACH,MAAMC,aAAa,GAAGF,UAAU,CAACG,GAAG,CAAEC,KAAK,IAAKA,KAAK,CAACC,GAAG,CAAC;;EAE1D;EACA,MAAMC,aAAa,GAAGP,aAAa,CAChCQ,MAAM,CAAEH,KAAK,IAAK,CAACF,aAAa,CAACM,QAAQ,CAACJ,KAAK,CAACC,GAAG,CAAC,CAAC,CACrDI,OAAO,EAAE;EAEZ,MAAMC,gBAA6B;EACjC;EACAT,MAAM,CAACP,kBAAkB,CAAC,IAAI,IAAIiB,GAAG,EAAU;EAEjD,MAAMC,kBAAkB,GAAG;IACzB,GAAGX,MAAM;IACT,CAACP,kBAAkB,GAAGgB;EACxB,CAAC;EAED,KAAK,MAAMN,KAAK,IAAIE,aAAa,EAAE;IAAA;IACjC,IAAII,gBAAgB,CAACG,GAAG,CAACT,KAAK,CAACC,GAAG,CAAC,EAAE;MACnC;MACA;IACF;;IAEA;IACA,MAAMS,WAAW,4BAAGhB,qBAAqB,CAACM,KAAK,CAACC,GAAG,CAAC,0DAAhC,2BAAAP,qBAAqB,EAAcc,kBAAkB,CAAC;IAE1E,IAAIE,WAAW,EAAE;MACf,OAAO,IAAI;IACb;IAEAJ,gBAAgB,CAACK,GAAG,CAACX,KAAK,CAACC,GAAG,CAAC;IAE/B,MAAMW,KAAK,GAAGnB,OAAO,CAACoB,IAAI,CAAC;MACzBC,IAAI,EAAE,cAAc;MACpBC,MAAM,EAAEf,KAAK,CAACC,GAAG;MACjBe,IAAI,EAAE;QAAEnB,MAAM,EAAEW;MAAmB,CAAC;MACpCS,iBAAiB,EAAE;IACrB,CAAC,CAAC;IAEF,IAAIL,KAAK,CAACM,gBAAgB,EAAE;MAC1B,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd,CAAC;AAAC;AAEa,SAASC,kBAAkB,OAI9B;EAAA,IAJ+B;IACzCC,QAAQ;IACR3B,OAAO;IACPC;EACO,CAAC;EACR,MAAM;IAAE2B;EAAiB,CAAC,GAAGC,KAAK,CAACC,UAAU,CAACC,iCAAwB,CAAC;EACvE,MAAMxB,KAAK,GAAGsB,KAAK,CAACC,UAAU,CAACE,+BAAsB,CAAC;EACtD,MAAMC,QAAQ,GAAG1B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEC,GAAG;EAE3BqB,KAAK,CAACK,SAAS,CAAC,MAAM;IACpB,IAAID,QAAQ,EAAE;MACZ,OAAOL,gBAAgB,aAAhBA,gBAAgB,uBAAhBA,gBAAgB,CAAG,cAAc,EAAEK,QAAQ,EAAG7B,MAAM,IAAK;QAC9D,MAAM+B,KAAK,GAAGR,QAAQ,EAAE;QAExB,OAAO5B,mBAAmB,CACxBC,OAAO,EACPC,qBAAqB,EACrBkC,KAAK,CAACC,MAAM,EACZ,EAAE,EACFhC,MAAM,CACP;MACH,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACwB,gBAAgB,EAAE3B,qBAAqB,EAAED,OAAO,EAAE2B,QAAQ,EAAEM,QAAQ,CAAC,CAAC;AAC5E"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useOnRouteFocus;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _NavigationBuilderContext = _interopRequireDefault(require("./NavigationBuilderContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Hook to handle focus actions for a route.
|
|
20
14
|
* Focus action needs to be treated specially, coz when a nested route is focused,
|
|
@@ -33,11 +27,9 @@ function useOnRouteFocus(_ref) {
|
|
|
33
27
|
return React.useCallback(key => {
|
|
34
28
|
const state = getState();
|
|
35
29
|
const result = router.getStateForRouteFocus(state, key);
|
|
36
|
-
|
|
37
30
|
if (result !== state) {
|
|
38
31
|
setState(result);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
if (onRouteFocusParent !== undefined && sourceRouteKey !== undefined) {
|
|
42
34
|
onRouteFocusParent(sourceRouteKey);
|
|
43
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useOnRouteFocus","router","getState","key","sourceRouteKey","setState","onRouteFocus","onRouteFocusParent","React","useContext","NavigationBuilderContext","useCallback","state","result","getStateForRouteFocus","undefined"],"
|
|
1
|
+
{"version":3,"names":["useOnRouteFocus","router","getState","key","sourceRouteKey","setState","onRouteFocus","onRouteFocusParent","React","useContext","NavigationBuilderContext","useCallback","state","result","getStateForRouteFocus","undefined"],"sourceRoot":"../../src","sources":["useOnRouteFocus.tsx"],"mappings":";;;;;;AAKA;AAEA;AAAkE;AAAA;AAAA;AASlE;AACA;AACA;AACA;AACA;AACe,SAASA,eAAe,OAKnB;EAAA,IALqD;IACvEC,MAAM;IACNC,QAAQ;IACRC,GAAG,EAAEC,cAAc;IACnBC;EACe,CAAC;EAChB,MAAM;IAAEC,YAAY,EAAEC;EAAmB,CAAC,GAAGC,KAAK,CAACC,UAAU,CAC3DC,iCAAwB,CACzB;EAED,OAAOF,KAAK,CAACG,WAAW,CACrBR,GAAW,IAAK;IACf,MAAMS,KAAK,GAAGV,QAAQ,EAAE;IACxB,MAAMW,MAAM,GAAGZ,MAAM,CAACa,qBAAqB,CAACF,KAAK,EAAET,GAAG,CAAC;IAEvD,IAAIU,MAAM,KAAKD,KAAK,EAAE;MACpBP,QAAQ,CAACQ,MAAM,CAAC;IAClB;IAEA,IAAIN,kBAAkB,KAAKQ,SAAS,IAAIX,cAAc,KAAKW,SAAS,EAAE;MACpER,kBAAkB,CAACH,cAAc,CAAC;IACpC;EACF,CAAC,EACD,CAACF,QAAQ,EAAEK,kBAAkB,EAAEN,MAAM,EAAEI,QAAQ,EAAED,cAAc,CAAC,CACjE;AACH"}
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useOptionsGetters;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _NavigationBuilderContext = _interopRequireDefault(require("./NavigationBuilderContext"));
|
|
11
|
-
|
|
12
9
|
var _NavigationStateContext = _interopRequireDefault(require("./NavigationStateContext"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
function useOptionsGetters(_ref) {
|
|
21
14
|
let {
|
|
22
15
|
key,
|
|
@@ -32,15 +25,10 @@ function useOptionsGetters(_ref) {
|
|
|
32
25
|
addOptionsGetter: parentAddOptionsGetter
|
|
33
26
|
} = React.useContext(_NavigationStateContext.default);
|
|
34
27
|
const optionsChangeListener = React.useCallback(() => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const isFocused = (_navigation$isFocused = navigation === null || navigation === void 0 ? void 0 : navigation.isFocused()) !== null && _navigation$isFocused !== void 0 ? _navigation$isFocused : true;
|
|
28
|
+
const isFocused = (navigation === null || navigation === void 0 ? void 0 : navigation.isFocused()) ?? true;
|
|
38
29
|
const hasChildren = Object.keys(optionsGettersFromChildRef.current).length;
|
|
39
|
-
|
|
40
30
|
if (isFocused && !hasChildren) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onOptionsChange((_optionsRef$current = optionsRef.current) !== null && _optionsRef$current !== void 0 ? _optionsRef$current : {});
|
|
31
|
+
onOptionsChange(optionsRef.current ?? {});
|
|
44
32
|
}
|
|
45
33
|
}, [navigation, onOptionsChange]);
|
|
46
34
|
React.useEffect(() => {
|
|
@@ -52,32 +40,25 @@ function useOptionsGetters(_ref) {
|
|
|
52
40
|
for (let key in optionsGettersFromChildRef.current) {
|
|
53
41
|
if (optionsGettersFromChildRef.current.hasOwnProperty(key)) {
|
|
54
42
|
var _optionsGettersFromCh, _optionsGettersFromCh2;
|
|
43
|
+
const result = (_optionsGettersFromCh = (_optionsGettersFromCh2 = optionsGettersFromChildRef.current)[key]) === null || _optionsGettersFromCh === void 0 ? void 0 : _optionsGettersFromCh.call(_optionsGettersFromCh2);
|
|
55
44
|
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
// null means unfocused route
|
|
58
46
|
if (result !== null) {
|
|
59
47
|
return result;
|
|
60
48
|
}
|
|
61
49
|
}
|
|
62
50
|
}
|
|
63
|
-
|
|
64
51
|
return null;
|
|
65
52
|
}, []);
|
|
66
53
|
const getCurrentOptions = React.useCallback(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const isFocused = (_navigation$isFocused2 = navigation === null || navigation === void 0 ? void 0 : navigation.isFocused()) !== null && _navigation$isFocused2 !== void 0 ? _navigation$isFocused2 : true;
|
|
70
|
-
|
|
54
|
+
const isFocused = (navigation === null || navigation === void 0 ? void 0 : navigation.isFocused()) ?? true;
|
|
71
55
|
if (!isFocused) {
|
|
72
56
|
return null;
|
|
73
57
|
}
|
|
74
|
-
|
|
75
58
|
const optionsFromListener = getOptionsFromListener();
|
|
76
|
-
|
|
77
59
|
if (optionsFromListener !== null) {
|
|
78
60
|
return optionsFromListener;
|
|
79
61
|
}
|
|
80
|
-
|
|
81
62
|
return optionsRef.current;
|
|
82
63
|
}, [navigation, getOptionsFromListener]);
|
|
83
64
|
React.useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useOptionsGetters","key","options","navigation","optionsRef","React","useRef","optionsGettersFromChildRef","onOptionsChange","useContext","NavigationBuilderContext","addOptionsGetter","parentAddOptionsGetter","NavigationStateContext","optionsChangeListener","useCallback","isFocused","hasChildren","Object","keys","current","length","useEffect","addListener","getOptionsFromListener","hasOwnProperty","result","getCurrentOptions","optionsFromListener","getter"],"
|
|
1
|
+
{"version":3,"names":["useOptionsGetters","key","options","navigation","optionsRef","React","useRef","optionsGettersFromChildRef","onOptionsChange","useContext","NavigationBuilderContext","addOptionsGetter","parentAddOptionsGetter","NavigationStateContext","optionsChangeListener","useCallback","isFocused","hasChildren","Object","keys","current","length","useEffect","addListener","getOptionsFromListener","hasOwnProperty","result","getCurrentOptions","optionsFromListener","getter"],"sourceRoot":"../../src","sources":["useOptionsGetters.tsx"],"mappings":";;;;;;AACA;AAEA;AACA;AAA8D;AAAA;AAAA;AAS/C,SAASA,iBAAiB,OAI7B;EAAA,IAJ8B;IACxCC,GAAG;IACHC,OAAO;IACPC;EACO,CAAC;EACR,MAAMC,UAAU,GAAGC,KAAK,CAACC,MAAM,CAAqBJ,OAAO,CAAC;EAC5D,MAAMK,0BAA0B,GAAGF,KAAK,CAACC,MAAM,CAE7C,CAAC,CAAC,CAAC;EAEL,MAAM;IAAEE;EAAgB,CAAC,GAAGH,KAAK,CAACI,UAAU,CAACC,iCAAwB,CAAC;EACtE,MAAM;IAAEC,gBAAgB,EAAEC;EAAuB,CAAC,GAAGP,KAAK,CAACI,UAAU,CACnEI,+BAAsB,CACvB;EAED,MAAMC,qBAAqB,GAAGT,KAAK,CAACU,WAAW,CAAC,MAAM;IACpD,MAAMC,SAAS,GAAG,CAAAb,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEa,SAAS,EAAE,KAAI,IAAI;IACjD,MAAMC,WAAW,GAAGC,MAAM,CAACC,IAAI,CAACZ,0BAA0B,CAACa,OAAO,CAAC,CAACC,MAAM;IAE1E,IAAIL,SAAS,IAAI,CAACC,WAAW,EAAE;MAC7BT,eAAe,CAACJ,UAAU,CAACgB,OAAO,IAAI,CAAC,CAAC,CAAC;IAC3C;EACF,CAAC,EAAE,CAACjB,UAAU,EAAEK,eAAe,CAAC,CAAC;EAEjCH,KAAK,CAACiB,SAAS,CAAC,MAAM;IACpBlB,UAAU,CAACgB,OAAO,GAAGlB,OAAO;IAC5BY,qBAAqB,EAAE;IAEvB,OAAOX,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEoB,WAAW,CAAC,OAAO,EAAET,qBAAqB,CAAC;EAChE,CAAC,EAAE,CAACX,UAAU,EAAED,OAAO,EAAEY,qBAAqB,CAAC,CAAC;EAEhD,MAAMU,sBAAsB,GAAGnB,KAAK,CAACU,WAAW,CAAC,MAAM;IACrD,KAAK,IAAId,GAAG,IAAIM,0BAA0B,CAACa,OAAO,EAAE;MAClD,IAAIb,0BAA0B,CAACa,OAAO,CAACK,cAAc,CAACxB,GAAG,CAAC,EAAE;QAAA;QAC1D,MAAMyB,MAAM,4BAAG,0BAAAnB,0BAA0B,CAACa,OAAO,EAACnB,GAAG,CAAC,0DAAvC,kDAA2C;;QAE1D;QACA,IAAIyB,MAAM,KAAK,IAAI,EAAE;UACnB,OAAOA,MAAM;QACf;MACF;IACF;IAEA,OAAO,IAAI;EACb,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,iBAAiB,GAAGtB,KAAK,CAACU,WAAW,CAAC,MAAM;IAChD,MAAMC,SAAS,GAAG,CAAAb,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEa,SAAS,EAAE,KAAI,IAAI;IAEjD,IAAI,CAACA,SAAS,EAAE;MACd,OAAO,IAAI;IACb;IAEA,MAAMY,mBAAmB,GAAGJ,sBAAsB,EAAE;IAEpD,IAAII,mBAAmB,KAAK,IAAI,EAAE;MAChC,OAAOA,mBAAmB;IAC5B;IAEA,OAAOxB,UAAU,CAACgB,OAAO;EAC3B,CAAC,EAAE,CAACjB,UAAU,EAAEqB,sBAAsB,CAAC,CAAC;EAExCnB,KAAK,CAACiB,SAAS,CAAC,MAAM;IACpB,OAAOV,sBAAsB,aAAtBA,sBAAsB,uBAAtBA,sBAAsB,CAAGX,GAAG,EAAG0B,iBAAiB,CAAC;EAC1D,CAAC,EAAE,CAACA,iBAAiB,EAAEf,sBAAsB,EAAEX,GAAG,CAAC,CAAC;EAEpD,MAAMU,gBAAgB,GAAGN,KAAK,CAACU,WAAW,CACxC,CAACd,GAAW,EAAE4B,MAAuC,KAAK;IACxDtB,0BAA0B,CAACa,OAAO,CAACnB,GAAG,CAAC,GAAG4B,MAAM;IAChDf,qBAAqB,EAAE;IAEvB,OAAO,MAAM;MACX;MACA,OAAOP,0BAA0B,CAACa,OAAO,CAACnB,GAAG,CAAC;MAC9Ca,qBAAqB,EAAE;IACzB,CAAC;EACH,CAAC,EACD,CAACA,qBAAqB,CAAC,CACxB;EAED,OAAO;IACLH,gBAAgB;IAChBgB;EACF,CAAC;AACH"}
|
|
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = usePreventRemove;
|
|
7
|
-
|
|
8
7
|
var _nonSecure = require("nanoid/non-secure");
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _useLatestCallback = _interopRequireDefault(require("use-latest-callback"));
|
|
13
|
-
|
|
14
10
|
var _useNavigation = _interopRequireDefault(require("./useNavigation"));
|
|
15
|
-
|
|
16
11
|
var _usePreventRemoveContext = _interopRequireDefault(require("./usePreventRemoveContext"));
|
|
17
|
-
|
|
18
12
|
var _useRoute = _interopRequireDefault(require("./useRoute"));
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
* Hook to prevent screen from being removed. Can be used to prevent users from leaving the screen.
|
|
28
18
|
*
|
|
@@ -48,7 +38,6 @@ function usePreventRemove(preventRemove, callback) {
|
|
|
48
38
|
if (!preventRemove) {
|
|
49
39
|
return;
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
e.preventDefault();
|
|
53
42
|
callback({
|
|
54
43
|
data: e.data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["usePreventRemove","preventRemove","callback","id","React","useState","nanoid","navigation","useNavigation","key","routeKey","useRoute","setPreventRemove","usePreventRemoveContext","useEffect","beforeRemoveListener","useLatestCallback","e","preventDefault","data","addListener"],"
|
|
1
|
+
{"version":3,"names":["usePreventRemove","preventRemove","callback","id","React","useState","nanoid","navigation","useNavigation","key","routeKey","useRoute","setPreventRemove","usePreventRemoveContext","useEffect","beforeRemoveListener","useLatestCallback","e","preventDefault","data","addListener"],"sourceRoot":"../../src","sources":["usePreventRemove.tsx"],"mappings":";;;;;;AACA;AACA;AACA;AAGA;AACA;AACA;AAAkC;AAAA;AAAA;AAElC;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,gBAAgB,CACtCC,aAAsB,EACtBC,QAAmE,EACnE;EACA,MAAM,CAACC,EAAE,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAAC,MAAM,IAAAC,iBAAM,GAAE,CAAC;EAE3C,MAAMC,UAAU,GAAG,IAAAC,sBAAa,GAAE;EAClC,MAAM;IAAEC,GAAG,EAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAQ,GAAE;EAEpC,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,gCAAuB,GAAE;EAEtDT,KAAK,CAACU,SAAS,CAAC,MAAM;IACpBF,gBAAgB,CAACT,EAAE,EAAEO,QAAQ,EAAET,aAAa,CAAC;IAC7C,OAAO,MAAM;MACXW,gBAAgB,CAACT,EAAE,EAAEO,QAAQ,EAAE,KAAK,CAAC;IACvC,CAAC;EACH,CAAC,EAAE,CAACE,gBAAgB,EAAET,EAAE,EAAEO,QAAQ,EAAET,aAAa,CAAC,CAAC;EAEnD,MAAMc,oBAAoB,GAAG,IAAAC,0BAAiB,EAE3CC,CAAC,IAAK;IACP,IAAI,CAAChB,aAAa,EAAE;MAClB;IACF;IAEAgB,CAAC,CAACC,cAAc,EAAE;IAElBhB,QAAQ,CAAC;MAAEiB,IAAI,EAAEF,CAAC,CAACE;IAAK,CAAC,CAAC;EAC5B,CAAC,CAAC;EAEFf,KAAK,CAACU,SAAS,CACb,MAAMP,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEa,WAAW,CAAC,cAAc,EAAEL,oBAAoB,CAAC,EACnE,CAACR,UAAU,EAAEQ,oBAAoB,CAAC,CACnC;AACH"}
|
|
@@ -4,24 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = usePreventRemoveContext;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _PreventRemoveContext = _interopRequireDefault(require("./PreventRemoveContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
function usePreventRemoveContext() {
|
|
19
13
|
const value = React.useContext(_PreventRemoveContext.default);
|
|
20
|
-
|
|
21
14
|
if (value == null) {
|
|
22
15
|
throw new Error("Couldn't find the prevent remove context. Is your component inside NavigationContent?");
|
|
23
16
|
}
|
|
24
|
-
|
|
25
17
|
return value;
|
|
26
18
|
}
|
|
27
19
|
//# sourceMappingURL=usePreventRemoveContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["usePreventRemoveContext","value","React","useContext","PreventRemoveContext","Error"],"
|
|
1
|
+
{"version":3,"names":["usePreventRemoveContext","value","React","useContext","PreventRemoveContext","Error"],"sourceRoot":"../../src","sources":["usePreventRemoveContext.tsx"],"mappings":";;;;;;AAAA;AAEA;AAA0D;AAAA;AAAA;AAE3C,SAASA,uBAAuB,GAAG;EAChD,MAAMC,KAAK,GAAGC,KAAK,CAACC,UAAU,CAACC,6BAAoB,CAAC;EAEpD,IAAIH,KAAK,IAAI,IAAI,EAAE;IACjB,MAAM,IAAII,KAAK,CACb,uFAAuF,CACxF;EACH;EAEA,OAAOJ,KAAK;AACd"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useRegisterNavigator;
|
|
7
|
-
|
|
8
7
|
var _nonSecure = require("nanoid/non-secure");
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _EnsureSingleNavigator = require("./EnsureSingleNavigator");
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Register a navigator in the parent context (either a navigation container or a screen).
|
|
20
14
|
* This is used to prevent multiple navigators under a single container or screen.
|
|
@@ -22,11 +16,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
22
16
|
function useRegisterNavigator() {
|
|
23
17
|
const [key] = React.useState(() => (0, _nonSecure.nanoid)());
|
|
24
18
|
const container = React.useContext(_EnsureSingleNavigator.SingleNavigatorContext);
|
|
25
|
-
|
|
26
19
|
if (container === undefined) {
|
|
27
20
|
throw new Error("Couldn't register the navigator. Have you wrapped your app with 'NavigationContainer'?\n\nThis can also happen if there are multiple copies of '@react-navigation' packages installed.");
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
React.useEffect(() => {
|
|
31
23
|
const {
|
|
32
24
|
register,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRegisterNavigator","key","React","useState","nanoid","container","useContext","SingleNavigatorContext","undefined","Error","useEffect","register","unregister"],"
|
|
1
|
+
{"version":3,"names":["useRegisterNavigator","key","React","useState","nanoid","container","useContext","SingleNavigatorContext","undefined","Error","useEffect","register","unregister"],"sourceRoot":"../../src","sources":["useRegisterNavigator.tsx"],"mappings":";;;;;;AAAA;AACA;AAEA;AAAiE;AAAA;AAEjE;AACA;AACA;AACA;AACe,SAASA,oBAAoB,GAAG;EAC7C,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK,CAACC,QAAQ,CAAC,MAAM,IAAAC,iBAAM,GAAE,CAAC;EAC5C,MAAMC,SAAS,GAAGH,KAAK,CAACI,UAAU,CAACC,6CAAsB,CAAC;EAE1D,IAAIF,SAAS,KAAKG,SAAS,EAAE;IAC3B,MAAM,IAAIC,KAAK,CACb,wLAAwL,CACzL;EACH;EAEAP,KAAK,CAACQ,SAAS,CAAC,MAAM;IACpB,MAAM;MAAEC,QAAQ;MAAEC;IAAW,CAAC,GAAGP,SAAS;IAE1CM,QAAQ,CAACV,GAAG,CAAC;IAEb,OAAO,MAAMW,UAAU,CAACX,GAAG,CAAC;EAC9B,CAAC,EAAE,CAACI,SAAS,EAAEJ,GAAG,CAAC,CAAC;EAEpB,OAAOA,GAAG;AACZ"}
|
package/lib/commonjs/useRoute.js
CHANGED
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useRoute;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _NavigationRouteContext = _interopRequireDefault(require("./NavigationRouteContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Hook to access the route prop of the parent screen anywhere.
|
|
20
14
|
*
|
|
@@ -22,11 +16,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
22
16
|
*/
|
|
23
17
|
function useRoute() {
|
|
24
18
|
const route = React.useContext(_NavigationRouteContext.default);
|
|
25
|
-
|
|
26
19
|
if (route === undefined) {
|
|
27
20
|
throw new Error("Couldn't find a route object. Is your component inside a screen in a navigator?");
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
return route;
|
|
31
23
|
}
|
|
32
24
|
//# sourceMappingURL=useRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRoute","route","React","useContext","NavigationRouteContext","undefined","Error"],"
|
|
1
|
+
{"version":3,"names":["useRoute","route","React","useContext","NavigationRouteContext","undefined","Error"],"sourceRoot":"../../src","sources":["useRoute.tsx"],"mappings":";;;;;;AACA;AAEA;AAA8D;AAAA;AAAA;AAG9D;AACA;AACA;AACA;AACA;AACe,SAASA,QAAQ,GAA0C;EACxE,MAAMC,KAAK,GAAGC,KAAK,CAACC,UAAU,CAACC,+BAAsB,CAAC;EAEtD,IAAIH,KAAK,KAAKI,SAAS,EAAE;IACvB,MAAM,IAAIC,KAAK,CACb,iFAAiF,CAClF;EACH;EAEA,OAAOL,KAAK;AACd"}
|
|
@@ -5,40 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CHILD_STATE = void 0;
|
|
7
7
|
exports.default = useRouteCache;
|
|
8
|
-
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
|
|
13
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* Utilites such as `getFocusedRouteNameFromRoute` need to access state.
|
|
17
13
|
* So we need a way to suppress the warning for those use cases.
|
|
18
14
|
* This is fine since they are internal utilities and this is not public API.
|
|
19
15
|
*/
|
|
20
16
|
const CHILD_STATE = Symbol('CHILD_STATE');
|
|
17
|
+
|
|
21
18
|
/**
|
|
22
19
|
* Hook to cache route props for each screen in the navigator.
|
|
23
20
|
* This lets add warnings and modifications to the route object but keep references between renders.
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
22
|
exports.CHILD_STATE = CHILD_STATE;
|
|
27
|
-
|
|
28
23
|
function useRouteCache(routes) {
|
|
29
24
|
// Cache object which holds route objects for each screen
|
|
30
25
|
const cache = React.useMemo(() => ({
|
|
31
26
|
current: new Map()
|
|
32
27
|
}), []);
|
|
33
|
-
|
|
34
28
|
if (process.env.NODE_ENV === 'production') {
|
|
35
29
|
// We don't want the overhead of creating extra maps every render in prod
|
|
36
30
|
return routes;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
cache.current = routes.reduce((acc, route) => {
|
|
40
33
|
const previous = cache.current.get(route);
|
|
41
|
-
|
|
42
34
|
if (previous) {
|
|
43
35
|
// If a cached route object already exists, reuse it
|
|
44
36
|
acc.set(route, previous);
|
|
@@ -53,7 +45,6 @@ function useRouteCache(routes) {
|
|
|
53
45
|
});
|
|
54
46
|
acc.set(route, proxy);
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
return acc;
|
|
58
49
|
}, new Map());
|
|
59
50
|
return Array.from(cache.current.values());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CHILD_STATE","Symbol","useRouteCache","routes","cache","React","useMemo","current","Map","process","env","NODE_ENV","reduce","acc","route","previous","get","set","state","proxy","Object","defineProperty","enumerable","value","Array","from","values"],"
|
|
1
|
+
{"version":3,"names":["CHILD_STATE","Symbol","useRouteCache","routes","cache","React","useMemo","current","Map","process","env","NODE_ENV","reduce","acc","route","previous","get","set","state","proxy","Object","defineProperty","enumerable","value","Array","from","values"],"sourceRoot":"../../src","sources":["useRouteCache.tsx"],"mappings":";;;;;;;AAKA;AAA+B;AAAA;AAM/B;AACA;AACA;AACA;AACA;AACO,MAAMA,WAAW,GAAGC,MAAM,CAAC,aAAa,CAAC;;AAEhD;AACA;AACA;AACA;AAHA;AAIe,SAASC,aAAa,CACnCC,MAAuB,EACvB;EACA;EACA,MAAMC,KAAK,GAAGC,KAAK,CAACC,OAAO,CAAC,OAAO;IAAEC,OAAO,EAAE,IAAIC,GAAG;EAAiB,CAAC,CAAC,EAAE,EAAE,CAAC;EAE7E,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC;IACA,OAAOR,MAAM;EACf;EAEAC,KAAK,CAACG,OAAO,GAAGJ,MAAM,CAACS,MAAM,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IAC5C,MAAMC,QAAQ,GAAGX,KAAK,CAACG,OAAO,CAACS,GAAG,CAACF,KAAK,CAAC;IAEzC,IAAIC,QAAQ,EAAE;MACZ;MACAF,GAAG,CAACI,GAAG,CAACH,KAAK,EAAEC,QAAQ,CAAC;IAC1B,CAAC,MAAM;MACL,MAAM;QAAEG,KAAK;QAAE,GAAGC;MAAM,CAAC,GAAGL,KAAK;MAEjCM,MAAM,CAACC,cAAc,CAACF,KAAK,EAAEnB,WAAW,EAAE;QACxCsB,UAAU,EAAE,KAAK;QACjBC,KAAK,EAAEL;MACT,CAAC,CAAC;MAEFL,GAAG,CAACI,GAAG,CAACH,KAAK,EAAEK,KAAK,CAAC;IACvB;IAEA,OAAON,GAAG;EACZ,CAAC,EAAE,IAAIL,GAAG,EAAE,CAAe;EAE3B,OAAOgB,KAAK,CAACC,IAAI,CAACrB,KAAK,CAACG,OAAO,CAACmB,MAAM,EAAE,CAAC;AAC3C"}
|
|
@@ -5,24 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ScheduleUpdateContext = void 0;
|
|
7
7
|
exports.default = useScheduleUpdate;
|
|
8
|
-
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
|
|
13
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
|
|
15
11
|
const MISSING_CONTEXT_ERROR = "Couldn't find a schedule context.";
|
|
16
12
|
const ScheduleUpdateContext = /*#__PURE__*/React.createContext({
|
|
17
13
|
scheduleUpdate() {
|
|
18
14
|
throw new Error(MISSING_CONTEXT_ERROR);
|
|
19
15
|
},
|
|
20
|
-
|
|
21
16
|
flushUpdates() {
|
|
22
17
|
throw new Error(MISSING_CONTEXT_ERROR);
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
});
|
|
20
|
+
|
|
26
21
|
/**
|
|
27
22
|
* When screen config changes, we want to update the navigator in the same update phase.
|
|
28
23
|
* However, navigation state is in the root component and React won't let us update it from a child.
|
|
@@ -30,9 +25,7 @@ const ScheduleUpdateContext = /*#__PURE__*/React.createContext({
|
|
|
30
25
|
* It lets all subsequent updates access the latest state so it stays correct.
|
|
31
26
|
* Then we call setState during after the component updates.
|
|
32
27
|
*/
|
|
33
|
-
|
|
34
28
|
exports.ScheduleUpdateContext = ScheduleUpdateContext;
|
|
35
|
-
|
|
36
29
|
function useScheduleUpdate(callback) {
|
|
37
30
|
const {
|
|
38
31
|
scheduleUpdate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["MISSING_CONTEXT_ERROR","ScheduleUpdateContext","React","createContext","scheduleUpdate","Error","flushUpdates","useScheduleUpdate","callback","useContext","useEffect"],"
|
|
1
|
+
{"version":3,"names":["MISSING_CONTEXT_ERROR","ScheduleUpdateContext","React","createContext","scheduleUpdate","Error","flushUpdates","useScheduleUpdate","callback","useContext","useEffect"],"sourceRoot":"../../src","sources":["useScheduleUpdate.tsx"],"mappings":";;;;;;;AAAA;AAA+B;AAAA;AAE/B,MAAMA,qBAAqB,GAAG,mCAAmC;AAE1D,MAAMC,qBAAqB,gBAAGC,KAAK,CAACC,aAAa,CAGrD;EACDC,cAAc,GAAG;IACf,MAAM,IAAIC,KAAK,CAACL,qBAAqB,CAAC;EACxC,CAAC;EACDM,YAAY,GAAG;IACb,MAAM,IAAID,KAAK,CAACL,qBAAqB,CAAC;EACxC;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOe,SAASO,iBAAiB,CAACC,QAAoB,EAAE;EAC9D,MAAM;IAAEJ,cAAc;IAAEE;EAAa,CAAC,GAAGJ,KAAK,CAACO,UAAU,CACvDR,qBAAqB,CACtB;EAEDG,cAAc,CAACI,QAAQ,CAAC;EAExBN,KAAK,CAACQ,SAAS,CAACJ,YAAY,CAAC;AAC/B"}
|