@react-navigation/core 7.0.0-alpha.0 → 7.0.0-alpha.2
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 +35 -36
- package/lib/commonjs/BaseNavigationContainer.js.map +1 -1
- package/lib/commonjs/CurrentRenderContext.js +2 -3
- package/lib/commonjs/CurrentRenderContext.js.map +1 -1
- package/lib/commonjs/DeprecatedNavigationInChildContext.js +2 -3
- package/lib/commonjs/DeprecatedNavigationInChildContext.js.map +1 -1
- package/lib/commonjs/EnsureSingleNavigator.js +1 -1
- package/lib/commonjs/EnsureSingleNavigator.js.map +1 -1
- package/lib/commonjs/Group.js +1 -1
- package/lib/commonjs/Group.js.map +1 -1
- package/lib/commonjs/NavigationBuilderContext.js +2 -3
- package/lib/commonjs/NavigationBuilderContext.js.map +1 -1
- package/lib/commonjs/NavigationContainerRefContext.js +2 -3
- package/lib/commonjs/NavigationContainerRefContext.js.map +1 -1
- package/lib/commonjs/NavigationContext.js +2 -3
- package/lib/commonjs/NavigationContext.js.map +1 -1
- package/lib/commonjs/NavigationHelpersContext.js +2 -3
- package/lib/commonjs/NavigationHelpersContext.js.map +1 -1
- package/lib/commonjs/NavigationIndependentTree.js +7 -8
- package/lib/commonjs/NavigationIndependentTree.js.map +1 -1
- package/lib/commonjs/NavigationIndependentTreeContext.js +2 -3
- package/lib/commonjs/NavigationIndependentTreeContext.js.map +1 -1
- package/lib/commonjs/NavigationRouteContext.js +2 -3
- package/lib/commonjs/NavigationRouteContext.js.map +1 -1
- package/lib/commonjs/NavigationStateContext.js +3 -3
- package/lib/commonjs/NavigationStateContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveContext.js +2 -3
- package/lib/commonjs/PreventRemoveContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveProvider.js +8 -8
- package/lib/commonjs/PreventRemoveProvider.js.map +1 -1
- package/lib/commonjs/SceneView.js +8 -9
- package/lib/commonjs/SceneView.js.map +1 -1
- package/lib/commonjs/Screen.js +1 -1
- package/lib/commonjs/Screen.js.map +1 -1
- package/lib/commonjs/StaticContainer.js +4 -5
- package/lib/commonjs/StaticContainer.js.map +1 -1
- package/lib/commonjs/StaticNavigation.js +3 -5
- package/lib/commonjs/StaticNavigation.js.map +1 -1
- package/lib/commonjs/UnhandledActionContext.js +2 -3
- package/lib/commonjs/UnhandledActionContext.js.map +1 -1
- package/lib/commonjs/checkDuplicateRouteNames.js +1 -1
- package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -1
- package/lib/commonjs/checkSerializable.js +1 -1
- package/lib/commonjs/checkSerializable.js.map +1 -1
- package/lib/commonjs/createNavigationContainerRef.js +1 -1
- package/lib/commonjs/createNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/createNavigatorFactory.js +7 -8
- package/lib/commonjs/createNavigatorFactory.js.map +1 -1
- package/lib/commonjs/findFocusedRoute.js +1 -1
- package/lib/commonjs/findFocusedRoute.js.map +1 -1
- package/lib/commonjs/getActionFromState.js +1 -1
- package/lib/commonjs/getActionFromState.js.map +1 -1
- package/lib/commonjs/getFocusedRouteNameFromRoute.js +1 -1
- package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/commonjs/getPathFromState.js +10 -7
- package/lib/commonjs/getPathFromState.js.map +1 -1
- package/lib/commonjs/getStateFromPath.js +20 -5
- package/lib/commonjs/getStateFromPath.js.map +1 -1
- package/lib/commonjs/index.js +56 -78
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/isArrayEqual.js +1 -1
- package/lib/commonjs/isArrayEqual.js.map +1 -1
- package/lib/commonjs/isRecordEqual.js +1 -1
- package/lib/commonjs/isRecordEqual.js.map +1 -1
- package/lib/commonjs/types.js +1 -8
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useChildListeners.js +1 -1
- package/lib/commonjs/useChildListeners.js.map +1 -1
- package/lib/commonjs/useComponent.js +1 -1
- package/lib/commonjs/useComponent.js.map +1 -1
- package/lib/commonjs/useCurrentRender.js +3 -4
- package/lib/commonjs/useCurrentRender.js.map +1 -1
- package/lib/commonjs/useDescriptors.js +14 -15
- package/lib/commonjs/useDescriptors.js.map +1 -1
- package/lib/commonjs/useEventEmitter.js +1 -1
- package/lib/commonjs/useEventEmitter.js.map +1 -1
- package/lib/commonjs/useFocusEffect.js +3 -4
- package/lib/commonjs/useFocusEffect.js.map +1 -1
- package/lib/commonjs/useFocusEvents.js +3 -4
- package/lib/commonjs/useFocusEvents.js.map +1 -1
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js +3 -4
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/commonjs/useIsFocused.js +3 -4
- package/lib/commonjs/useIsFocused.js.map +1 -1
- package/lib/commonjs/useKeyedChildListeners.js +1 -1
- package/lib/commonjs/useKeyedChildListeners.js.map +1 -1
- package/lib/commonjs/useNavigation.js +5 -6
- package/lib/commonjs/useNavigation.js.map +1 -1
- package/lib/commonjs/useNavigationBuilder.js +44 -45
- package/lib/commonjs/useNavigationBuilder.js.map +1 -1
- package/lib/commonjs/useNavigationCache.js +3 -4
- package/lib/commonjs/useNavigationCache.js.map +1 -1
- package/lib/commonjs/useNavigationContainerRef.js +3 -4
- package/lib/commonjs/useNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/useNavigationHelpers.js +5 -6
- package/lib/commonjs/useNavigationHelpers.js.map +1 -1
- package/lib/commonjs/useNavigationIndependentTree.js +3 -4
- package/lib/commonjs/useNavigationIndependentTree.js.map +1 -1
- package/lib/commonjs/useNavigationState.js +3 -4
- package/lib/commonjs/useNavigationState.js.map +1 -1
- package/lib/commonjs/useOnAction.js +7 -8
- package/lib/commonjs/useOnAction.js.map +1 -1
- package/lib/commonjs/useOnGetState.js +7 -8
- package/lib/commonjs/useOnGetState.js.map +1 -1
- package/lib/commonjs/useOnPreventRemove.js +5 -6
- package/lib/commonjs/useOnPreventRemove.js.map +1 -1
- package/lib/commonjs/useOnRouteFocus.js +3 -4
- package/lib/commonjs/useOnRouteFocus.js.map +1 -1
- package/lib/commonjs/useOptionsGetters.js +5 -6
- package/lib/commonjs/useOptionsGetters.js.map +1 -1
- package/lib/commonjs/usePreventRemove.js +8 -8
- package/lib/commonjs/usePreventRemove.js.map +1 -1
- package/lib/commonjs/usePreventRemoveContext.js +3 -4
- package/lib/commonjs/usePreventRemoveContext.js.map +1 -1
- package/lib/commonjs/useRegisterNavigator.js +1 -1
- package/lib/commonjs/useRegisterNavigator.js.map +1 -1
- package/lib/commonjs/useRoute.js +3 -4
- package/lib/commonjs/useRoute.js.map +1 -1
- package/lib/commonjs/useRouteCache.js +1 -1
- package/lib/commonjs/useRouteCache.js.map +1 -1
- package/lib/commonjs/useScheduleUpdate.js +1 -1
- package/lib/commonjs/useScheduleUpdate.js.map +1 -1
- package/lib/commonjs/useSyncState.js +1 -1
- package/lib/commonjs/useSyncState.js.map +1 -1
- package/lib/commonjs/validatePathConfig.js +38 -11
- package/lib/commonjs/validatePathConfig.js.map +1 -1
- package/lib/module/BaseNavigationContainer.js +17 -18
- package/lib/module/BaseNavigationContainer.js.map +1 -1
- package/lib/module/CurrentRenderContext.js +1 -2
- package/lib/module/CurrentRenderContext.js.map +1 -1
- package/lib/module/DeprecatedNavigationInChildContext.js +1 -2
- package/lib/module/DeprecatedNavigationInChildContext.js.map +1 -1
- package/lib/module/EnsureSingleNavigator.js +1 -1
- package/lib/module/EnsureSingleNavigator.js.map +1 -1
- package/lib/module/Group.js +1 -1
- package/lib/module/Group.js.map +1 -1
- package/lib/module/NavigationBuilderContext.js +1 -2
- package/lib/module/NavigationBuilderContext.js.map +1 -1
- package/lib/module/NavigationContainerRefContext.js +1 -2
- package/lib/module/NavigationContainerRefContext.js.map +1 -1
- package/lib/module/NavigationContext.js +1 -2
- package/lib/module/NavigationContext.js.map +1 -1
- package/lib/module/NavigationHelpersContext.js +1 -2
- package/lib/module/NavigationHelpersContext.js.map +1 -1
- package/lib/module/NavigationIndependentTree.js +4 -4
- package/lib/module/NavigationIndependentTree.js.map +1 -1
- package/lib/module/NavigationIndependentTreeContext.js +1 -2
- package/lib/module/NavigationIndependentTreeContext.js.map +1 -1
- package/lib/module/NavigationRouteContext.js +1 -2
- package/lib/module/NavigationRouteContext.js.map +1 -1
- package/lib/module/NavigationStateContext.js +1 -1
- package/lib/module/NavigationStateContext.js.map +1 -1
- package/lib/module/PreventRemoveContext.js +1 -2
- package/lib/module/PreventRemoveContext.js.map +1 -1
- package/lib/module/PreventRemoveProvider.js +4 -4
- package/lib/module/PreventRemoveProvider.js.map +1 -1
- package/lib/module/SceneView.js +5 -5
- package/lib/module/SceneView.js.map +1 -1
- package/lib/module/Screen.js +1 -1
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/StaticContainer.js +2 -3
- package/lib/module/StaticContainer.js.map +1 -1
- package/lib/module/StaticNavigation.js +2 -3
- package/lib/module/StaticNavigation.js.map +1 -1
- package/lib/module/UnhandledActionContext.js +1 -2
- package/lib/module/UnhandledActionContext.js.map +1 -1
- package/lib/module/checkDuplicateRouteNames.js +1 -1
- package/lib/module/checkDuplicateRouteNames.js.map +1 -1
- package/lib/module/checkSerializable.js +1 -1
- package/lib/module/checkSerializable.js.map +1 -1
- package/lib/module/createNavigationContainerRef.js +1 -1
- package/lib/module/createNavigationContainerRef.js.map +1 -1
- package/lib/module/createNavigatorFactory.js +3 -3
- package/lib/module/createNavigatorFactory.js.map +1 -1
- package/lib/module/findFocusedRoute.js +1 -1
- package/lib/module/findFocusedRoute.js.map +1 -1
- package/lib/module/getActionFromState.js +1 -1
- package/lib/module/getActionFromState.js.map +1 -1
- package/lib/module/getFocusedRouteNameFromRoute.js +1 -1
- package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/module/getPathFromState.js +9 -5
- package/lib/module/getPathFromState.js.map +1 -1
- package/lib/module/getStateFromPath.js +18 -3
- package/lib/module/getStateFromPath.js.map +1 -1
- package/lib/module/index.js +28 -28
- package/lib/module/index.js.map +1 -1
- package/lib/module/isArrayEqual.js +1 -1
- package/lib/module/isArrayEqual.js.map +1 -1
- package/lib/module/isRecordEqual.js +1 -1
- package/lib/module/isRecordEqual.js.map +1 -1
- package/lib/module/types.js +1 -8
- package/lib/module/types.js.map +1 -1
- package/lib/module/useChildListeners.js +1 -1
- package/lib/module/useChildListeners.js.map +1 -1
- package/lib/module/useComponent.js +1 -1
- package/lib/module/useComponent.js.map +1 -1
- package/lib/module/useCurrentRender.js +2 -2
- package/lib/module/useCurrentRender.js.map +1 -1
- package/lib/module/useDescriptors.js +7 -7
- package/lib/module/useDescriptors.js.map +1 -1
- package/lib/module/useEventEmitter.js +1 -1
- package/lib/module/useEventEmitter.js.map +1 -1
- package/lib/module/useFocusEffect.js +2 -2
- package/lib/module/useFocusEffect.js.map +1 -1
- package/lib/module/useFocusEvents.js +2 -2
- package/lib/module/useFocusEvents.js.map +1 -1
- package/lib/module/useFocusedListenersChildrenAdapter.js +2 -2
- package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/module/useIsFocused.js +2 -2
- package/lib/module/useIsFocused.js.map +1 -1
- package/lib/module/useKeyedChildListeners.js +1 -1
- package/lib/module/useKeyedChildListeners.js.map +1 -1
- package/lib/module/useNavigation.js +3 -3
- package/lib/module/useNavigation.js.map +1 -1
- package/lib/module/useNavigationBuilder.js +23 -23
- package/lib/module/useNavigationBuilder.js.map +1 -1
- package/lib/module/useNavigationCache.js +2 -2
- package/lib/module/useNavigationCache.js.map +1 -1
- package/lib/module/useNavigationContainerRef.js +2 -2
- package/lib/module/useNavigationContainerRef.js.map +1 -1
- package/lib/module/useNavigationHelpers.js +3 -3
- package/lib/module/useNavigationHelpers.js.map +1 -1
- package/lib/module/useNavigationIndependentTree.js +2 -2
- package/lib/module/useNavigationIndependentTree.js.map +1 -1
- package/lib/module/useNavigationState.js +2 -2
- package/lib/module/useNavigationState.js.map +1 -1
- package/lib/module/useOnAction.js +4 -4
- package/lib/module/useOnAction.js.map +1 -1
- package/lib/module/useOnGetState.js +4 -4
- package/lib/module/useOnGetState.js.map +1 -1
- package/lib/module/useOnPreventRemove.js +3 -3
- package/lib/module/useOnPreventRemove.js.map +1 -1
- package/lib/module/useOnRouteFocus.js +2 -2
- package/lib/module/useOnRouteFocus.js.map +1 -1
- package/lib/module/useOptionsGetters.js +3 -3
- package/lib/module/useOptionsGetters.js.map +1 -1
- package/lib/module/usePreventRemove.js +4 -4
- package/lib/module/usePreventRemove.js.map +1 -1
- package/lib/module/usePreventRemoveContext.js +2 -2
- package/lib/module/usePreventRemoveContext.js.map +1 -1
- package/lib/module/useRegisterNavigator.js +1 -1
- package/lib/module/useRegisterNavigator.js.map +1 -1
- package/lib/module/useRoute.js +2 -2
- package/lib/module/useRoute.js.map +1 -1
- package/lib/module/useRouteCache.js +1 -1
- package/lib/module/useRouteCache.js.map +1 -1
- package/lib/module/useScheduleUpdate.js +1 -1
- package/lib/module/useScheduleUpdate.js.map +1 -1
- package/lib/module/useSyncState.js +1 -1
- package/lib/module/useSyncState.js.map +1 -1
- package/lib/module/validatePathConfig.js +38 -11
- package/lib/module/validatePathConfig.js.map +1 -1
- package/lib/typescript/src/BaseNavigationContainer.d.ts +1 -2
- package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/CurrentRenderContext.d.ts +1 -2
- package/lib/typescript/src/CurrentRenderContext.d.ts.map +1 -1
- package/lib/typescript/src/DeprecatedNavigationInChildContext.d.ts +1 -2
- package/lib/typescript/src/DeprecatedNavigationInChildContext.d.ts.map +1 -1
- package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -1
- package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -1
- package/lib/typescript/src/Group.d.ts +1 -1
- package/lib/typescript/src/Group.d.ts.map +1 -1
- package/lib/typescript/src/NavigationBuilderContext.d.ts +1 -2
- package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainerRefContext.d.ts +1 -2
- package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContext.d.ts +1 -2
- package/lib/typescript/src/NavigationContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -2
- package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationIndependentTree.d.ts +1 -1
- package/lib/typescript/src/NavigationIndependentTree.d.ts.map +1 -1
- package/lib/typescript/src/NavigationIndependentTreeContext.d.ts +1 -2
- package/lib/typescript/src/NavigationIndependentTreeContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationRouteContext.d.ts +1 -2
- package/lib/typescript/src/NavigationRouteContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationStateContext.d.ts +1 -2
- package/lib/typescript/src/NavigationStateContext.d.ts.map +1 -1
- package/lib/typescript/src/PreventRemoveContext.d.ts +1 -2
- package/lib/typescript/src/PreventRemoveContext.d.ts.map +1 -1
- package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -1
- package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
- package/lib/typescript/src/SceneView.d.ts +1 -2
- package/lib/typescript/src/SceneView.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts +1 -1
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/StaticContainer.d.ts +1 -3
- package/lib/typescript/src/StaticContainer.d.ts.map +1 -1
- package/lib/typescript/src/StaticNavigation.d.ts +11 -4
- package/lib/typescript/src/StaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/UnhandledActionContext.d.ts +1 -2
- package/lib/typescript/src/UnhandledActionContext.d.ts.map +1 -1
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts +1 -1
- package/lib/typescript/src/checkDuplicateRouteNames.d.ts.map +1 -1
- package/lib/typescript/src/checkSerializable.d.ts +1 -1
- package/lib/typescript/src/checkSerializable.d.ts.map +1 -1
- package/lib/typescript/src/createNavigationContainerRef.d.ts +1 -1
- package/lib/typescript/src/createNavigationContainerRef.d.ts.map +1 -1
- package/lib/typescript/src/createNavigatorFactory.d.ts +1 -1
- package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -1
- package/lib/typescript/src/findFocusedRoute.d.ts +1 -1
- package/lib/typescript/src/findFocusedRoute.d.ts.map +1 -1
- package/lib/typescript/src/getActionFromState.d.ts +1 -1
- package/lib/typescript/src/getActionFromState.d.ts.map +1 -1
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts +1 -1
- package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts.map +1 -1
- package/lib/typescript/src/getPathFromState.d.ts +2 -1
- package/lib/typescript/src/getPathFromState.d.ts.map +1 -1
- package/lib/typescript/src/getStateFromPath.d.ts +2 -1
- package/lib/typescript/src/getStateFromPath.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +28 -28
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/isArrayEqual.d.ts +1 -1
- package/lib/typescript/src/isArrayEqual.d.ts.map +1 -1
- package/lib/typescript/src/isRecordEqual.d.ts +1 -1
- package/lib/typescript/src/isRecordEqual.d.ts.map +1 -1
- package/lib/typescript/src/useChildListeners.d.ts +1 -1
- package/lib/typescript/src/useChildListeners.d.ts.map +1 -1
- package/lib/typescript/src/useComponent.d.ts +1 -1
- package/lib/typescript/src/useComponent.d.ts.map +1 -1
- package/lib/typescript/src/useCurrentRender.d.ts +1 -1
- package/lib/typescript/src/useCurrentRender.d.ts.map +1 -1
- package/lib/typescript/src/useDescriptors.d.ts +1 -1
- package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
- package/lib/typescript/src/useEventEmitter.d.ts +1 -1
- package/lib/typescript/src/useEventEmitter.d.ts.map +1 -1
- package/lib/typescript/src/useFocusEffect.d.ts +1 -1
- package/lib/typescript/src/useFocusEffect.d.ts.map +1 -1
- package/lib/typescript/src/useFocusEvents.d.ts +1 -1
- package/lib/typescript/src/useFocusEvents.d.ts.map +1 -1
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +1 -1
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -1
- package/lib/typescript/src/useIsFocused.d.ts +1 -1
- package/lib/typescript/src/useIsFocused.d.ts.map +1 -1
- package/lib/typescript/src/useKeyedChildListeners.d.ts +1 -1
- package/lib/typescript/src/useKeyedChildListeners.d.ts.map +1 -1
- package/lib/typescript/src/useNavigation.d.ts +1 -1
- package/lib/typescript/src/useNavigation.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationBuilder.d.ts +1 -1
- package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationCache.d.ts +1 -1
- package/lib/typescript/src/useNavigationCache.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationContainerRef.d.ts +1 -1
- package/lib/typescript/src/useNavigationContainerRef.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationHelpers.d.ts +17 -1
- package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationIndependentTree.d.ts +1 -1
- package/lib/typescript/src/useNavigationIndependentTree.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationState.d.ts +1 -1
- package/lib/typescript/src/useNavigationState.d.ts.map +1 -1
- package/lib/typescript/src/useOnAction.d.ts +1 -1
- package/lib/typescript/src/useOnAction.d.ts.map +1 -1
- package/lib/typescript/src/useOnGetState.d.ts +1 -1
- package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
- package/lib/typescript/src/useOnPreventRemove.d.ts +1 -1
- package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -1
- package/lib/typescript/src/useOnRouteFocus.d.ts +1 -1
- package/lib/typescript/src/useOnRouteFocus.d.ts.map +1 -1
- package/lib/typescript/src/useOptionsGetters.d.ts +1 -1
- package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -1
- package/lib/typescript/src/usePreventRemove.d.ts +1 -1
- package/lib/typescript/src/usePreventRemove.d.ts.map +1 -1
- package/lib/typescript/src/usePreventRemoveContext.d.ts +1 -1
- package/lib/typescript/src/usePreventRemoveContext.d.ts.map +1 -1
- package/lib/typescript/src/useRegisterNavigator.d.ts +1 -1
- package/lib/typescript/src/useRegisterNavigator.d.ts.map +1 -1
- package/lib/typescript/src/useRoute.d.ts +1 -1
- package/lib/typescript/src/useRoute.d.ts.map +1 -1
- package/lib/typescript/src/useRouteCache.d.ts +1 -1
- package/lib/typescript/src/useRouteCache.d.ts.map +1 -1
- package/lib/typescript/src/useScheduleUpdate.d.ts +1 -1
- package/lib/typescript/src/useScheduleUpdate.d.ts.map +1 -1
- package/lib/typescript/src/useSyncState.d.ts +1 -1
- package/lib/typescript/src/useSyncState.d.ts.map +1 -1
- package/lib/typescript/src/validatePathConfig.d.ts +1 -1
- package/lib/typescript/src/validatePathConfig.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/BaseNavigationContainer.tsx +17 -19
- package/src/CurrentRenderContext.tsx +1 -3
- package/src/DeprecatedNavigationInChildContext.tsx +1 -3
- package/src/EnsureSingleNavigator.tsx +1 -1
- package/src/Group.tsx +1 -1
- package/src/NavigationBuilderContext.tsx +1 -3
- package/src/NavigationContainerRefContext.tsx +1 -3
- package/src/NavigationContext.tsx +1 -3
- package/src/NavigationHelpersContext.tsx +1 -3
- package/src/NavigationIndependentTree.tsx +4 -4
- package/src/NavigationIndependentTreeContext.tsx +1 -3
- package/src/NavigationRouteContext.tsx +3 -5
- package/src/NavigationStateContext.tsx +1 -1
- package/src/PreventRemoveContext.tsx +1 -3
- package/src/PreventRemoveProvider.tsx +4 -4
- package/src/SceneView.tsx +5 -5
- package/src/Screen.tsx +1 -1
- package/src/StaticContainer.tsx +19 -18
- package/src/StaticNavigation.tsx +15 -13
- package/src/UnhandledActionContext.tsx +1 -3
- package/src/checkDuplicateRouteNames.tsx +1 -1
- package/src/checkSerializable.tsx +1 -1
- package/src/createNavigationContainerRef.tsx +1 -1
- package/src/createNavigatorFactory.tsx +3 -3
- package/src/findFocusedRoute.tsx +1 -1
- package/src/getActionFromState.tsx +1 -1
- package/src/getFocusedRouteNameFromRoute.tsx +1 -1
- package/src/getPathFromState.tsx +10 -5
- package/src/getStateFromPath.tsx +19 -3
- package/src/index.tsx +30 -30
- package/src/isArrayEqual.tsx +1 -1
- package/src/isRecordEqual.tsx +1 -4
- package/src/useChildListeners.tsx +1 -1
- package/src/useComponent.tsx +1 -1
- package/src/useCurrentRender.tsx +2 -6
- package/src/useDescriptors.tsx +8 -7
- package/src/useEventEmitter.tsx +1 -1
- package/src/useFocusEffect.tsx +2 -2
- package/src/useFocusEvents.tsx +2 -2
- package/src/useFocusedListenersChildrenAdapter.tsx +3 -2
- package/src/useIsFocused.tsx +2 -2
- package/src/useKeyedChildListeners.tsx +1 -1
- package/src/useNavigation.tsx +3 -3
- package/src/useNavigationBuilder.tsx +23 -23
- package/src/useNavigationCache.tsx +2 -2
- package/src/useNavigationContainerRef.tsx +2 -2
- package/src/useNavigationHelpers.tsx +3 -3
- package/src/useNavigationIndependentTree.tsx +2 -2
- package/src/useNavigationState.tsx +2 -2
- package/src/useOnAction.tsx +5 -4
- package/src/useOnGetState.tsx +5 -7
- package/src/useOnPreventRemove.tsx +4 -3
- package/src/useOnRouteFocus.tsx +2 -2
- package/src/useOptionsGetters.tsx +3 -7
- package/src/usePreventRemove.tsx +4 -4
- package/src/usePreventRemoveContext.tsx +2 -2
- package/src/useRegisterNavigator.tsx +1 -1
- package/src/useRoute.tsx +2 -2
- package/src/useRouteCache.tsx +1 -1
- package/src/useScheduleUpdate.tsx +1 -1
- package/src/useSyncState.tsx +1 -1
- package/src/validatePathConfig.tsx +58 -14
- package/lib/commonjs/fromEntries.js +0 -18
- package/lib/commonjs/fromEntries.js.map +0 -1
- package/lib/module/fromEntries.js +0 -12
- package/lib/module/fromEntries.js.map +0 -1
- package/lib/typescript/src/fromEntries.d.ts +0 -2
- package/lib/typescript/src/fromEntries.d.ts.map +0 -1
- package/src/fromEntries.tsx +0 -13
|
@@ -69,6 +69,6 @@ const checkSerializableWithoutCircularReference = (
|
|
|
69
69
|
return { serializable: true };
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
export
|
|
72
|
+
export function checkSerializable(o: { [key: string]: any }) {
|
|
73
73
|
return checkSerializableWithoutCircularReference(o, new Set<any>(), []);
|
|
74
74
|
}
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
export const NOT_INITIALIZED_ERROR =
|
|
10
10
|
"The 'navigation' object hasn't been initialized yet. This might happen if you don't have a navigator mounted, or if the navigator hasn't finished mounting. See https://reactnavigation.org/docs/navigating-without-navigation-prop#handling-initialization for more details.";
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export function createNavigationContainerRef<
|
|
13
13
|
ParamList extends {} = ReactNavigation.RootParamList
|
|
14
14
|
>(): NavigationContainerRefWithCurrent<ParamList> {
|
|
15
15
|
const methods = [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
|
2
2
|
import type * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import Group from './Group';
|
|
5
|
-
import Screen from './Screen';
|
|
4
|
+
import { Group } from './Group';
|
|
5
|
+
import { Screen } from './Screen';
|
|
6
6
|
import type { StaticConfig } from './StaticNavigation';
|
|
7
7
|
import type { EventMapBase, TypedNavigator } from './types';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ import type { EventMapBase, TypedNavigator } from './types';
|
|
|
13
13
|
* @param Navigator The navigator component to wrap.
|
|
14
14
|
* @returns Factory method to create a `Navigator` and `Screen` pair.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export function createNavigatorFactory<
|
|
17
17
|
State extends NavigationState,
|
|
18
18
|
ScreenOptions extends {},
|
|
19
19
|
EventMap extends EventMapBase,
|
package/src/findFocusedRoute.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InitialState } from '@react-navigation/routers';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function findFocusedRoute(state: InitialState) {
|
|
4
4
|
let current: InitialState | undefined = state;
|
|
5
5
|
|
|
6
6
|
while (current?.routes[current.index ?? 0].state != null) {
|
|
@@ -28,7 +28,7 @@ type NavigateAction<State extends NavigationState> = {
|
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export
|
|
31
|
+
export function getActionFromState(
|
|
32
32
|
state: PartialState<NavigationState>,
|
|
33
33
|
options?: Options
|
|
34
34
|
): NavigateAction<NavigationState> | CommonActions.Action | undefined {
|
|
@@ -2,7 +2,7 @@ import type { Route } from '@react-navigation/routers';
|
|
|
2
2
|
|
|
3
3
|
import { CHILD_STATE } from './useRouteCache';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function getFocusedRouteNameFromRoute(
|
|
6
6
|
route: Partial<Route<string>>
|
|
7
7
|
): string | undefined {
|
|
8
8
|
// @ts-expect-error: this isn't in type definitions coz we want this private
|
package/src/getPathFromState.tsx
CHANGED
|
@@ -5,11 +5,11 @@ import type {
|
|
|
5
5
|
} from '@react-navigation/routers';
|
|
6
6
|
import * as queryString from 'query-string';
|
|
7
7
|
|
|
8
|
-
import fromEntries from './fromEntries';
|
|
9
8
|
import type { PathConfig, PathConfigMap } from './types';
|
|
10
|
-
import validatePathConfig from './validatePathConfig';
|
|
9
|
+
import { validatePathConfig } from './validatePathConfig';
|
|
11
10
|
|
|
12
11
|
type Options<ParamList extends {}> = {
|
|
12
|
+
path?: string;
|
|
13
13
|
initialRouteName?: string;
|
|
14
14
|
screens: PathConfigMap<ParamList>;
|
|
15
15
|
};
|
|
@@ -66,7 +66,7 @@ const getActiveRoute = (state: State): { name: string; params?: object } => {
|
|
|
66
66
|
* @param options Extra options to fine-tune how to serialize the path.
|
|
67
67
|
* @returns Path representing the state, e.g. /foo/bar?count=42.
|
|
68
68
|
*/
|
|
69
|
-
export
|
|
69
|
+
export function getPathFromState<ParamList extends {}>(
|
|
70
70
|
state: State,
|
|
71
71
|
options?: Options<ParamList>
|
|
72
72
|
): string {
|
|
@@ -115,7 +115,7 @@ export default function getPathFromState<ParamList extends {}>(
|
|
|
115
115
|
if (route.params) {
|
|
116
116
|
const stringify = currentOptions[route.name]?.stringify;
|
|
117
117
|
|
|
118
|
-
const currentParams = fromEntries(
|
|
118
|
+
const currentParams = Object.fromEntries(
|
|
119
119
|
Object.entries(route.params).map(([key, value]) => [
|
|
120
120
|
key,
|
|
121
121
|
stringify?.[key] ? stringify[key](value) : String(value),
|
|
@@ -234,6 +234,11 @@ export default function getPathFromState<ParamList extends {}>(
|
|
|
234
234
|
path = path.replace(/\/+/g, '/');
|
|
235
235
|
path = path.length > 1 ? path.replace(/\/$/, '') : path;
|
|
236
236
|
|
|
237
|
+
// Include the root path if specified
|
|
238
|
+
if (options?.path) {
|
|
239
|
+
path = joinPaths(options.path, path);
|
|
240
|
+
}
|
|
241
|
+
|
|
237
242
|
return path;
|
|
238
243
|
}
|
|
239
244
|
|
|
@@ -288,7 +293,7 @@ const createNormalizedConfigs = (
|
|
|
288
293
|
options: PathConfigMap<object>,
|
|
289
294
|
pattern?: string
|
|
290
295
|
): Record<string, ConfigItem> =>
|
|
291
|
-
fromEntries(
|
|
296
|
+
Object.fromEntries(
|
|
292
297
|
Object.entries(options).map(([name, c]) => {
|
|
293
298
|
const result = createConfigItem(c, pattern);
|
|
294
299
|
|
package/src/getStateFromPath.tsx
CHANGED
|
@@ -6,11 +6,12 @@ import type {
|
|
|
6
6
|
import escape from 'escape-string-regexp';
|
|
7
7
|
import * as queryString from 'query-string';
|
|
8
8
|
|
|
9
|
-
import findFocusedRoute from './findFocusedRoute';
|
|
9
|
+
import { findFocusedRoute } from './findFocusedRoute';
|
|
10
10
|
import type { PathConfigMap } from './types';
|
|
11
|
-
import validatePathConfig from './validatePathConfig';
|
|
11
|
+
import { validatePathConfig } from './validatePathConfig';
|
|
12
12
|
|
|
13
13
|
type Options<ParamList extends {}> = {
|
|
14
|
+
path?: string;
|
|
14
15
|
initialRouteName?: string;
|
|
15
16
|
screens: PathConfigMap<ParamList>;
|
|
16
17
|
};
|
|
@@ -62,7 +63,7 @@ type ParsedRoute = {
|
|
|
62
63
|
* @param path Path string to parse and convert, e.g. /foo/bar?count=42.
|
|
63
64
|
* @param options Extra options to fine-tune how to parse the path.
|
|
64
65
|
*/
|
|
65
|
-
export
|
|
66
|
+
export function getStateFromPath<ParamList extends {}>(
|
|
66
67
|
path: string,
|
|
67
68
|
options?: Options<ParamList>
|
|
68
69
|
): ResultState | undefined {
|
|
@@ -89,6 +90,21 @@ export default function getStateFromPath<ParamList extends {}>(
|
|
|
89
90
|
// Make sure there is a trailing slash
|
|
90
91
|
remaining = remaining.endsWith('/') ? remaining : `${remaining}/`;
|
|
91
92
|
|
|
93
|
+
const prefix = options?.path?.replace(/^\//, ''); // Remove extra leading slash
|
|
94
|
+
|
|
95
|
+
if (prefix) {
|
|
96
|
+
// Make sure there is a trailing slash
|
|
97
|
+
const normalizedPrefix = prefix.endsWith('/') ? prefix : `${prefix}/`;
|
|
98
|
+
|
|
99
|
+
// If the path doesn't start with the prefix, it's not a match
|
|
100
|
+
if (!remaining.startsWith(normalizedPrefix)) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Remove the prefix from the path
|
|
105
|
+
remaining = remaining.replace(normalizedPrefix, '');
|
|
106
|
+
}
|
|
107
|
+
|
|
92
108
|
if (screens === undefined) {
|
|
93
109
|
// When no config is specified, use the path segments as route names
|
|
94
110
|
const routes = remaining
|
package/src/index.tsx
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
1
|
+
export { BaseNavigationContainer } from './BaseNavigationContainer';
|
|
2
|
+
export { createNavigationContainerRef } from './createNavigationContainerRef';
|
|
3
|
+
export { createNavigatorFactory } from './createNavigatorFactory';
|
|
4
|
+
export { CurrentRenderContext } from './CurrentRenderContext';
|
|
5
|
+
export { findFocusedRoute } from './findFocusedRoute';
|
|
6
|
+
export { getActionFromState } from './getActionFromState';
|
|
7
|
+
export { getFocusedRouteNameFromRoute } from './getFocusedRouteNameFromRoute';
|
|
8
|
+
export { getPathFromState } from './getPathFromState';
|
|
9
|
+
export { getStateFromPath } from './getStateFromPath';
|
|
10
|
+
export { NavigationContainerRefContext } from './NavigationContainerRefContext';
|
|
11
|
+
export { NavigationContext } from './NavigationContext';
|
|
12
|
+
export { NavigationHelpersContext } from './NavigationHelpersContext';
|
|
13
|
+
export { NavigationIndependentTree } from './NavigationIndependentTree';
|
|
14
|
+
export { NavigationRouteContext } from './NavigationRouteContext';
|
|
15
|
+
export { PreventRemoveContext } from './PreventRemoveContext';
|
|
16
|
+
export { PreventRemoveProvider } from './PreventRemoveProvider';
|
|
17
17
|
export {
|
|
18
|
+
type StaticNavigation,
|
|
19
|
+
type StaticParamList,
|
|
20
|
+
type StaticScreenProps,
|
|
18
21
|
createComponentForStaticNavigation,
|
|
19
22
|
createPathConfigForStaticNavigation,
|
|
20
|
-
StaticNavigation,
|
|
21
|
-
StaticParamList,
|
|
22
|
-
StaticScreenProps,
|
|
23
23
|
} from './StaticNavigation';
|
|
24
24
|
export * from './types';
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
25
|
+
export { useFocusEffect } from './useFocusEffect';
|
|
26
|
+
export { useIsFocused } from './useIsFocused';
|
|
27
|
+
export { useNavigation } from './useNavigation';
|
|
28
|
+
export { useNavigationBuilder } from './useNavigationBuilder';
|
|
29
|
+
export { useNavigationContainerRef } from './useNavigationContainerRef';
|
|
30
|
+
export { useNavigationIndependentTree } from './useNavigationIndependentTree';
|
|
31
|
+
export { useNavigationState } from './useNavigationState';
|
|
32
|
+
export { UNSTABLE_usePreventRemove } from './usePreventRemove';
|
|
33
|
+
export { usePreventRemoveContext } from './usePreventRemoveContext';
|
|
34
|
+
export { useRoute } from './useRoute';
|
|
35
|
+
export { validatePathConfig } from './validatePathConfig';
|
|
36
36
|
export * from '@react-navigation/routers';
|
package/src/isArrayEqual.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Compare two arrays with primitive values as the content.
|
|
3
3
|
* We need to make sure that both values and order match.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export function isArrayEqual(a: any[], b: any[]) {
|
|
6
6
|
if (a === b) {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
package/src/isRecordEqual.tsx
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compare two records with primitive values as the content.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
5
|
-
a: Record<string, any>,
|
|
6
|
-
b: Record<string, any>
|
|
7
|
-
) {
|
|
4
|
+
export function isRecordEqual(a: Record<string, any>, b: Record<string, any>) {
|
|
8
5
|
if (a === b) {
|
|
9
6
|
return true;
|
|
10
7
|
}
|
|
@@ -5,7 +5,7 @@ import type { ListenerMap } from './NavigationBuilderContext';
|
|
|
5
5
|
/**
|
|
6
6
|
* Hook which lets child navigators add action listeners.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export function useChildListeners() {
|
|
9
9
|
const { current: listeners } = React.useRef<{
|
|
10
10
|
[K in keyof ListenerMap]: ListenerMap[K][];
|
|
11
11
|
}>({
|
package/src/useComponent.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const NavigationContent = ({ render, children }: Props) => {
|
|
|
11
11
|
return render(children);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export function useComponent(render: Render) {
|
|
15
15
|
const renderRef = React.useRef<Render | null>(render);
|
|
16
16
|
|
|
17
17
|
// Normally refs shouldn't be mutated in render
|
package/src/useCurrentRender.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import CurrentRenderContext from './CurrentRenderContext';
|
|
4
|
+
import { CurrentRenderContext } from './CurrentRenderContext';
|
|
5
5
|
import type {
|
|
6
6
|
Descriptor,
|
|
7
7
|
NavigationHelpers,
|
|
@@ -22,11 +22,7 @@ type Options = {
|
|
|
22
22
|
* Write the current options, so that server renderer can get current values
|
|
23
23
|
* Mutating values like this is not safe in async mode, but it doesn't apply to SSR
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
26
|
-
state,
|
|
27
|
-
navigation,
|
|
28
|
-
descriptors,
|
|
29
|
-
}: Options) {
|
|
25
|
+
export function useCurrentRender({ state, navigation, descriptors }: Options) {
|
|
30
26
|
const current = React.useContext(CurrentRenderContext);
|
|
31
27
|
|
|
32
28
|
if (current && navigation.isFocused()) {
|
package/src/useDescriptors.tsx
CHANGED
|
@@ -6,13 +6,14 @@ import type {
|
|
|
6
6
|
} from '@react-navigation/routers';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
10
|
AddKeyedListener,
|
|
11
11
|
AddListener,
|
|
12
|
+
NavigationBuilderContext,
|
|
12
13
|
} from './NavigationBuilderContext';
|
|
13
|
-
import NavigationContext from './NavigationContext';
|
|
14
|
-
import NavigationRouteContext from './NavigationRouteContext';
|
|
15
|
-
import SceneView from './SceneView';
|
|
14
|
+
import { NavigationContext } from './NavigationContext';
|
|
15
|
+
import { NavigationRouteContext } from './NavigationRouteContext';
|
|
16
|
+
import { SceneView } from './SceneView';
|
|
16
17
|
import type {
|
|
17
18
|
Descriptor,
|
|
18
19
|
EventMapBase,
|
|
@@ -22,8 +23,8 @@ import type {
|
|
|
22
23
|
RouteProp,
|
|
23
24
|
} from './types';
|
|
24
25
|
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
25
|
-
import useNavigationCache from './useNavigationCache';
|
|
26
|
-
import useRouteCache from './useRouteCache';
|
|
26
|
+
import { useNavigationCache } from './useNavigationCache';
|
|
27
|
+
import { useRouteCache } from './useRouteCache';
|
|
27
28
|
|
|
28
29
|
export type ScreenConfigWithParent<
|
|
29
30
|
State extends NavigationState,
|
|
@@ -79,7 +80,7 @@ type Options<
|
|
|
79
80
|
* - Options specified by the screen for the navigator
|
|
80
81
|
* - Navigation object intended for the route
|
|
81
82
|
*/
|
|
82
|
-
export
|
|
83
|
+
export function useDescriptors<
|
|
83
84
|
State extends NavigationState,
|
|
84
85
|
ActionHelpers extends Record<string, () => void>,
|
|
85
86
|
ScreenOptions extends {},
|
package/src/useEventEmitter.tsx
CHANGED
|
@@ -12,7 +12,7 @@ type Listeners = ((e: any) => void)[];
|
|
|
12
12
|
/**
|
|
13
13
|
* Hook to manage the event system used by the navigator to notify screens of various events.
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export function useEventEmitter<T extends Record<string, any>>(
|
|
16
16
|
listen?: (e: any) => void
|
|
17
17
|
): NavigationEventEmitter<T> {
|
|
18
18
|
const listenRef = React.useRef(listen);
|
package/src/useFocusEffect.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import useNavigation from './useNavigation';
|
|
3
|
+
import { useNavigation } from './useNavigation';
|
|
4
4
|
|
|
5
5
|
type EffectCallback = () => undefined | void | (() => void);
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ type EffectCallback = () => undefined | void | (() => void);
|
|
|
11
11
|
*
|
|
12
12
|
* @param callback Memoized callback containing the effect, should optionally return a cleanup function.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export function useFocusEffect(effect: EffectCallback) {
|
|
15
15
|
const navigation = useNavigation();
|
|
16
16
|
|
|
17
17
|
if (arguments[1] !== undefined) {
|
package/src/useFocusEvents.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NavigationState } from '@react-navigation/routers';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import NavigationContext from './NavigationContext';
|
|
4
|
+
import { NavigationContext } from './NavigationContext';
|
|
5
5
|
import type { EventMapCore } from './types';
|
|
6
6
|
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ type Options<State extends NavigationState> = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Hook to take care of emitting `focus` and `blur` events.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export function useFocusEvents<State extends NavigationState>({
|
|
17
17
|
state,
|
|
18
18
|
emitter,
|
|
19
19
|
}: Options<State>) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ParamListBase } from '@react-navigation/routers';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
5
|
FocusedNavigationCallback,
|
|
6
6
|
FocusedNavigationListener,
|
|
7
|
+
NavigationBuilderContext,
|
|
7
8
|
} from './NavigationBuilderContext';
|
|
8
9
|
import type { NavigationHelpers } from './types';
|
|
9
10
|
|
|
@@ -15,7 +16,7 @@ type Options = {
|
|
|
15
16
|
/**
|
|
16
17
|
* Hook for passing focus callback to children
|
|
17
18
|
*/
|
|
18
|
-
export
|
|
19
|
+
export function useFocusedListenersChildrenAdapter({
|
|
19
20
|
navigation,
|
|
20
21
|
focusedListeners,
|
|
21
22
|
}: Options) {
|
package/src/useIsFocused.tsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import useNavigation from './useNavigation';
|
|
4
|
+
import { useNavigation } from './useNavigation';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Hook to get the current focus state of the screen. Returns a `true` if screen is focused, otherwise `false`.
|
|
8
8
|
* This can be used if a component needs to render something based on the focus state.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export function useIsFocused(): boolean {
|
|
11
11
|
const navigation = useNavigation();
|
|
12
12
|
const [isFocused, setIsFocused] = useState(navigation.isFocused);
|
|
13
13
|
|
|
@@ -5,7 +5,7 @@ import type { KeyedListenerMap } from './NavigationBuilderContext';
|
|
|
5
5
|
/**
|
|
6
6
|
* Hook which lets child navigators add getters to be called for obtaining rehydrated state.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export function useKeyedChildListeners() {
|
|
9
9
|
const { current: keyedListeners } = React.useRef<{
|
|
10
10
|
[K in keyof KeyedListenerMap]: Record<
|
|
11
11
|
string,
|
package/src/useNavigation.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import NavigationContainerRefContext from './NavigationContainerRefContext';
|
|
4
|
-
import NavigationContext from './NavigationContext';
|
|
3
|
+
import { NavigationContainerRefContext } from './NavigationContainerRefContext';
|
|
4
|
+
import { NavigationContext } from './NavigationContext';
|
|
5
5
|
import type { NavigationProp } from './types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,7 +9,7 @@ import type { NavigationProp } from './types';
|
|
|
9
9
|
*
|
|
10
10
|
* @returns Navigation prop of the parent screen.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export function useNavigation<
|
|
13
13
|
T = NavigationProp<ReactNavigation.RootParamList>
|
|
14
14
|
>(): T {
|
|
15
15
|
const root = React.useContext(NavigationContainerRefContext);
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { isValidElementType } from 'react-is';
|
|
15
15
|
|
|
16
|
-
import Group from './Group';
|
|
17
|
-
import isArrayEqual from './isArrayEqual';
|
|
18
|
-
import isRecordEqual from './isRecordEqual';
|
|
19
|
-
import NavigationHelpersContext from './NavigationHelpersContext';
|
|
20
|
-
import NavigationRouteContext from './NavigationRouteContext';
|
|
21
|
-
import NavigationStateContext from './NavigationStateContext';
|
|
22
|
-
import PreventRemoveProvider from './PreventRemoveProvider';
|
|
23
|
-
import Screen from './Screen';
|
|
16
|
+
import { Group } from './Group';
|
|
17
|
+
import { isArrayEqual } from './isArrayEqual';
|
|
18
|
+
import { isRecordEqual } from './isRecordEqual';
|
|
19
|
+
import { NavigationHelpersContext } from './NavigationHelpersContext';
|
|
20
|
+
import { NavigationRouteContext } from './NavigationRouteContext';
|
|
21
|
+
import { NavigationStateContext } from './NavigationStateContext';
|
|
22
|
+
import { PreventRemoveProvider } from './PreventRemoveProvider';
|
|
23
|
+
import { Screen } from './Screen';
|
|
24
24
|
import {
|
|
25
25
|
DefaultNavigatorOptions,
|
|
26
26
|
EventMapBase,
|
|
@@ -30,20 +30,20 @@ import {
|
|
|
30
30
|
RouteConfig,
|
|
31
31
|
RouteProp,
|
|
32
32
|
} from './types';
|
|
33
|
-
import useChildListeners from './useChildListeners';
|
|
34
|
-
import useComponent from './useComponent';
|
|
35
|
-
import useCurrentRender from './useCurrentRender';
|
|
36
|
-
import
|
|
37
|
-
import useEventEmitter from './useEventEmitter';
|
|
38
|
-
import useFocusedListenersChildrenAdapter from './useFocusedListenersChildrenAdapter';
|
|
39
|
-
import useFocusEvents from './useFocusEvents';
|
|
40
|
-
import useKeyedChildListeners from './useKeyedChildListeners';
|
|
41
|
-
import useNavigationHelpers from './useNavigationHelpers';
|
|
42
|
-
import useOnAction from './useOnAction';
|
|
43
|
-
import useOnGetState from './useOnGetState';
|
|
44
|
-
import useOnRouteFocus from './useOnRouteFocus';
|
|
45
|
-
import useRegisterNavigator from './useRegisterNavigator';
|
|
46
|
-
import useScheduleUpdate from './useScheduleUpdate';
|
|
33
|
+
import { useChildListeners } from './useChildListeners';
|
|
34
|
+
import { useComponent } from './useComponent';
|
|
35
|
+
import { useCurrentRender } from './useCurrentRender';
|
|
36
|
+
import { ScreenConfigWithParent, useDescriptors } from './useDescriptors';
|
|
37
|
+
import { useEventEmitter } from './useEventEmitter';
|
|
38
|
+
import { useFocusedListenersChildrenAdapter } from './useFocusedListenersChildrenAdapter';
|
|
39
|
+
import { useFocusEvents } from './useFocusEvents';
|
|
40
|
+
import { useKeyedChildListeners } from './useKeyedChildListeners';
|
|
41
|
+
import { useNavigationHelpers } from './useNavigationHelpers';
|
|
42
|
+
import { useOnAction } from './useOnAction';
|
|
43
|
+
import { useOnGetState } from './useOnGetState';
|
|
44
|
+
import { useOnRouteFocus } from './useOnRouteFocus';
|
|
45
|
+
import { useRegisterNavigator } from './useRegisterNavigator';
|
|
46
|
+
import { useScheduleUpdate } from './useScheduleUpdate';
|
|
47
47
|
|
|
48
48
|
// This is to make TypeScript compiler happy
|
|
49
49
|
// eslint-disable-next-line babel/no-unused-expressions
|
|
@@ -252,7 +252,7 @@ const getRouteConfigsFromChildren = <
|
|
|
252
252
|
* @param options Options object containing `children` and additional options for the router.
|
|
253
253
|
* @returns An object containing `state`, `navigation`, `descriptors` objects.
|
|
254
254
|
*/
|
|
255
|
-
export
|
|
255
|
+
export function useNavigationBuilder<
|
|
256
256
|
State extends NavigationState,
|
|
257
257
|
RouterOptions extends DefaultRouterOptions,
|
|
258
258
|
ActionHelpers extends Record<string, () => void>,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@react-navigation/routers';
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
|
|
10
|
-
import NavigationBuilderContext from './NavigationBuilderContext';
|
|
10
|
+
import { NavigationBuilderContext } from './NavigationBuilderContext';
|
|
11
11
|
import type { NavigationHelpers, NavigationProp } from './types';
|
|
12
12
|
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
13
13
|
|
|
@@ -50,7 +50,7 @@ type NavigationCache<
|
|
|
50
50
|
* It's important to cache them to make sure navigation objects don't change between renders.
|
|
51
51
|
* This lets us apply optimizations like `React.memo` to minimize re-rendering screens.
|
|
52
52
|
*/
|
|
53
|
-
export
|
|
53
|
+
export function useNavigationCache<
|
|
54
54
|
State extends NavigationState,
|
|
55
55
|
ScreenOptions extends {},
|
|
56
56
|
EventMap extends Record<string, any>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import createNavigationContainerRef from './createNavigationContainerRef';
|
|
3
|
+
import { createNavigationContainerRef } from './createNavigationContainerRef';
|
|
4
4
|
import type { NavigationContainerRefWithCurrent } from './types';
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function useNavigationContainerRef<
|
|
7
7
|
ParamList extends {} = ReactNavigation.RootParamList
|
|
8
8
|
>(): NavigationContainerRefWithCurrent<ParamList> {
|
|
9
9
|
const navigation =
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@react-navigation/routers';
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
|
|
10
|
-
import NavigationContext from './NavigationContext';
|
|
10
|
+
import { NavigationContext } from './NavigationContext';
|
|
11
11
|
import { NavigationHelpers, PrivateValueStore } from './types';
|
|
12
|
-
import UnhandledActionContext from './UnhandledActionContext';
|
|
12
|
+
import { UnhandledActionContext } from './UnhandledActionContext';
|
|
13
13
|
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
14
14
|
|
|
15
15
|
// This is to make TypeScript compiler happy
|
|
@@ -28,7 +28,7 @@ type Options<State extends NavigationState, Action extends NavigationAction> = {
|
|
|
28
28
|
* Navigation object with helper methods to be used by a navigator.
|
|
29
29
|
* This object includes methods for common actions as well as methods the parent screen's navigation object.
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export function useNavigationHelpers<
|
|
32
32
|
State extends NavigationState,
|
|
33
33
|
ActionHelpers extends Record<string, () => void>,
|
|
34
34
|
Action extends NavigationAction,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import NavigationIndependentTreeContext from './NavigationIndependentTreeContext';
|
|
3
|
+
import { NavigationIndependentTreeContext } from './NavigationIndependentTreeContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function useNavigationIndependentTree() {
|
|
6
6
|
return React.useContext(NavigationIndependentTreeContext);
|
|
7
7
|
}
|
|
@@ -2,7 +2,7 @@ import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import type { NavigationProp } from './types';
|
|
5
|
-
import useNavigation from './useNavigation';
|
|
5
|
+
import { useNavigation } from './useNavigation';
|
|
6
6
|
|
|
7
7
|
type Selector<ParamList extends ParamListBase, T> = (
|
|
8
8
|
state: NavigationState<ParamList>
|
|
@@ -13,7 +13,7 @@ type Selector<ParamList extends ParamListBase, T> = (
|
|
|
13
13
|
*
|
|
14
14
|
* @param selector Selector function to get a value from the state.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export function useNavigationState<ParamList extends ParamListBase, T>(
|
|
17
17
|
selector: Selector<ParamList, T>
|
|
18
18
|
): T {
|
|
19
19
|
const navigation = useNavigation<NavigationProp<ParamList>>();
|
package/src/useOnAction.tsx
CHANGED
|
@@ -7,14 +7,15 @@ import type {
|
|
|
7
7
|
} from '@react-navigation/routers';
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
|
|
10
|
-
import DeprecatedNavigationInChildContext from './DeprecatedNavigationInChildContext';
|
|
11
|
-
import
|
|
10
|
+
import { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';
|
|
11
|
+
import {
|
|
12
12
|
ChildActionListener,
|
|
13
13
|
ChildBeforeRemoveListener,
|
|
14
|
+
NavigationBuilderContext,
|
|
14
15
|
} from './NavigationBuilderContext';
|
|
15
16
|
import type { EventMapCore } from './types';
|
|
16
17
|
import type { NavigationEventEmitter } from './useEventEmitter';
|
|
17
|
-
import
|
|
18
|
+
import { shouldPreventRemove, useOnPreventRemove } from './useOnPreventRemove';
|
|
18
19
|
|
|
19
20
|
type Options = {
|
|
20
21
|
router: Router<NavigationState, NavigationAction>;
|
|
@@ -36,7 +37,7 @@ type Options = {
|
|
|
36
37
|
*
|
|
37
38
|
* When the action handler handles as action, it returns `true`, otherwise `false`.
|
|
38
39
|
*/
|
|
39
|
-
export
|
|
40
|
+
export function useOnAction({
|
|
40
41
|
router,
|
|
41
42
|
getState,
|
|
42
43
|
setState,
|