@react-navigation/core 7.0.0-alpha.0 → 7.0.0-alpha.10
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 +57 -63
- package/lib/commonjs/BaseNavigationContainer.js.map +1 -1
- package/lib/commonjs/CurrentRenderContext.js +4 -6
- package/lib/commonjs/CurrentRenderContext.js.map +1 -1
- package/lib/commonjs/DeprecatedNavigationInChildContext.js +4 -6
- package/lib/commonjs/DeprecatedNavigationInChildContext.js.map +1 -1
- package/lib/commonjs/EnsureSingleNavigator.js +4 -5
- 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 +4 -6
- package/lib/commonjs/NavigationBuilderContext.js.map +1 -1
- package/lib/commonjs/NavigationContainerRefContext.js +4 -6
- package/lib/commonjs/NavigationContainerRefContext.js.map +1 -1
- package/lib/commonjs/NavigationContext.js +4 -6
- package/lib/commonjs/NavigationContext.js.map +1 -1
- package/lib/commonjs/NavigationHelpersContext.js +4 -6
- package/lib/commonjs/NavigationHelpersContext.js.map +1 -1
- package/lib/commonjs/NavigationIndependentTree.js +9 -10
- package/lib/commonjs/NavigationIndependentTree.js.map +1 -1
- package/lib/commonjs/NavigationIndependentTreeContext.js +4 -6
- package/lib/commonjs/NavigationIndependentTreeContext.js.map +1 -1
- package/lib/commonjs/NavigationRouteContext.js +4 -6
- package/lib/commonjs/NavigationRouteContext.js.map +1 -1
- package/lib/commonjs/NavigationStateContext.js +4 -5
- package/lib/commonjs/NavigationStateContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveContext.js +9 -6
- package/lib/commonjs/PreventRemoveContext.js.map +1 -1
- package/lib/commonjs/PreventRemoveProvider.js +16 -18
- package/lib/commonjs/PreventRemoveProvider.js.map +1 -1
- package/lib/commonjs/SceneView.js +10 -11
- 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 +5 -7
- package/lib/commonjs/StaticContainer.js.map +1 -1
- package/lib/commonjs/StaticNavigation.js +36 -10
- package/lib/commonjs/StaticNavigation.js.map +1 -1
- package/lib/commonjs/UnhandledActionContext.js +4 -6
- package/lib/commonjs/UnhandledActionContext.js.map +1 -1
- package/lib/commonjs/checkDuplicateRouteNames.js +2 -3
- 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 +2 -3
- package/lib/commonjs/createNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/createNavigatorFactory.js +7 -11
- package/lib/commonjs/createNavigatorFactory.js.map +1 -1
- package/lib/commonjs/findFocusedRoute.js +3 -5
- package/lib/commonjs/findFocusedRoute.js.map +1 -1
- package/lib/commonjs/getActionFromState.js +7 -9
- package/lib/commonjs/getActionFromState.js.map +1 -1
- package/lib/commonjs/getFocusedRouteNameFromRoute.js +2 -2
- package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/commonjs/getPathFromState.js +24 -25
- package/lib/commonjs/getPathFromState.js.map +1 -1
- package/lib/commonjs/getStateFromPath.js +29 -22
- package/lib/commonjs/getStateFromPath.js.map +1 -1
- package/lib/commonjs/index.js +78 -76
- 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/theming/ThemeContext.js +12 -0
- package/lib/commonjs/theming/ThemeContext.js.map +1 -0
- package/lib/commonjs/theming/ThemeProvider.js +20 -0
- package/lib/commonjs/theming/ThemeProvider.js.map +1 -0
- package/lib/commonjs/theming/useTheme.js +18 -0
- package/lib/commonjs/theming/useTheme.js.map +1 -0
- package/lib/commonjs/types.js +1 -8
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useChildListeners.js +3 -3
- package/lib/commonjs/useChildListeners.js.map +1 -1
- package/lib/commonjs/useComponent.js +3 -3
- package/lib/commonjs/useComponent.js.map +1 -1
- package/lib/commonjs/useCurrentRender.js +5 -6
- package/lib/commonjs/useCurrentRender.js.map +1 -1
- package/lib/commonjs/useDescriptors.js +92 -41
- package/lib/commonjs/useDescriptors.js.map +1 -1
- package/lib/commonjs/useEventEmitter.js +6 -7
- package/lib/commonjs/useEventEmitter.js.map +1 -1
- package/lib/commonjs/useFocusEffect.js +7 -6
- package/lib/commonjs/useFocusEffect.js.map +1 -1
- package/lib/commonjs/useFocusEvents.js +7 -8
- package/lib/commonjs/useFocusEvents.js.map +1 -1
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js +6 -7
- package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -1
- package/lib/commonjs/useIsFocused.js +8 -8
- package/lib/commonjs/useIsFocused.js.map +1 -1
- package/lib/commonjs/useIsomorphicLayoutEffect.js +12 -0
- package/lib/commonjs/useIsomorphicLayoutEffect.js.map +1 -0
- package/lib/commonjs/useIsomorphicLayoutEffect.native.js +9 -0
- package/lib/commonjs/useIsomorphicLayoutEffect.native.js.map +1 -0
- package/lib/commonjs/useKeyedChildListeners.js +3 -3
- package/lib/commonjs/useKeyedChildListeners.js.map +1 -1
- package/lib/commonjs/useNavigation.js +7 -8
- package/lib/commonjs/useNavigation.js.map +1 -1
- package/lib/commonjs/useNavigationBuilder.js +115 -106
- package/lib/commonjs/useNavigationBuilder.js.map +1 -1
- package/lib/commonjs/useNavigationCache.js +60 -20
- package/lib/commonjs/useNavigationCache.js.map +1 -1
- package/lib/commonjs/useNavigationContainerRef.js +5 -6
- package/lib/commonjs/useNavigationContainerRef.js.map +1 -1
- package/lib/commonjs/useNavigationHelpers.js +9 -11
- package/lib/commonjs/useNavigationHelpers.js.map +1 -1
- package/lib/commonjs/useNavigationIndependentTree.js +5 -6
- package/lib/commonjs/useNavigationIndependentTree.js.map +1 -1
- package/lib/commonjs/useNavigationState.js +5 -6
- package/lib/commonjs/useNavigationState.js.map +1 -1
- package/lib/commonjs/useOnAction.js +13 -12
- package/lib/commonjs/useOnAction.js.map +1 -1
- package/lib/commonjs/useOnGetState.js +11 -13
- package/lib/commonjs/useOnGetState.js.map +1 -1
- package/lib/commonjs/useOnPreventRemove.js +10 -12
- package/lib/commonjs/useOnPreventRemove.js.map +1 -1
- package/lib/commonjs/useOnRouteFocus.js +5 -6
- package/lib/commonjs/useOnRouteFocus.js.map +1 -1
- package/lib/commonjs/useOptionsGetters.js +14 -16
- package/lib/commonjs/useOptionsGetters.js.map +1 -1
- package/lib/commonjs/usePreventRemove.js +10 -10
- package/lib/commonjs/usePreventRemove.js.map +1 -1
- package/lib/commonjs/usePreventRemoveContext.js +5 -6
- package/lib/commonjs/usePreventRemoveContext.js.map +1 -1
- package/lib/commonjs/useRegisterNavigator.js +3 -3
- package/lib/commonjs/useRegisterNavigator.js.map +1 -1
- package/lib/commonjs/useRoute.js +5 -6
- package/lib/commonjs/useRoute.js.map +1 -1
- package/lib/commonjs/useRouteCache.js +20 -17
- package/lib/commonjs/useRouteCache.js.map +1 -1
- package/lib/commonjs/useSyncState.js +28 -57
- 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 +39 -44
- 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 +10 -12
- 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 +28 -6
- 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 +2 -3
- 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 -6
- package/lib/module/createNavigatorFactory.js.map +1 -1
- package/lib/module/findFocusedRoute.js +3 -5
- package/lib/module/findFocusedRoute.js.map +1 -1
- package/lib/module/getActionFromState.js +7 -9
- package/lib/module/getActionFromState.js.map +1 -1
- package/lib/module/getFocusedRouteNameFromRoute.js +2 -2
- package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -1
- package/lib/module/getPathFromState.js +21 -21
- package/lib/module/getPathFromState.js.map +1 -1
- package/lib/module/getStateFromPath.js +25 -18
- package/lib/module/getStateFromPath.js.map +1 -1
- package/lib/module/index.js +31 -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/theming/ThemeContext.js +4 -0
- package/lib/module/theming/ThemeContext.js.map +1 -0
- package/lib/module/theming/ThemeProvider.js +12 -0
- package/lib/module/theming/ThemeProvider.js.map +1 -0
- package/lib/module/theming/useTheme.js +10 -0
- package/lib/module/theming/useTheme.js.map +1 -0
- 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 +88 -36
- package/lib/module/useDescriptors.js.map +1 -1
- package/lib/module/useEventEmitter.js +4 -5
- package/lib/module/useEventEmitter.js.map +1 -1
- package/lib/module/useFocusEffect.js +4 -2
- package/lib/module/useFocusEffect.js.map +1 -1
- package/lib/module/useFocusEvents.js +4 -4
- package/lib/module/useFocusEvents.js.map +1 -1
- package/lib/module/useFocusedListenersChildrenAdapter.js +3 -3
- 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/useIsomorphicLayoutEffect.js +7 -0
- package/lib/module/useIsomorphicLayoutEffect.js.map +1 -0
- package/lib/module/useIsomorphicLayoutEffect.native.js +3 -0
- package/lib/module/useIsomorphicLayoutEffect.native.js.map +1 -0
- 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 +97 -88
- package/lib/module/useNavigationBuilder.js.map +1 -1
- package/lib/module/useNavigationCache.js +57 -16
- 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 +5 -6
- 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 +8 -6
- package/lib/module/useOnAction.js.map +1 -1
- package/lib/module/useOnGetState.js +6 -7
- package/lib/module/useOnGetState.js.map +1 -1
- package/lib/module/useOnPreventRemove.js +6 -7
- 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 +10 -11
- package/lib/module/useOptionsGetters.js.map +1 -1
- package/lib/module/usePreventRemove.js +5 -5
- 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 +17 -13
- package/lib/module/useRouteCache.js.map +1 -1
- package/lib/module/useSyncState.js +25 -54
- 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 +3 -3
- 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 -18
- 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 +2 -2
- 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 +3 -20
- 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 +2 -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 +12 -5
- 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 +2 -10
- 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 +31 -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/theming/ThemeContext.d.ts +3 -0
- package/lib/typescript/src/theming/ThemeContext.d.ts.map +1 -0
- package/lib/typescript/src/theming/ThemeProvider.d.ts +8 -0
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/src/theming/useTheme.d.ts +2 -0
- package/lib/typescript/src/theming/useTheme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +80 -1
- package/lib/typescript/src/types.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 +2 -2
- 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 +107 -59
- 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 +2 -2
- 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/useIsomorphicLayoutEffect.d.ts +6 -0
- package/lib/typescript/src/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/lib/typescript/src/useIsomorphicLayoutEffect.native.d.ts +3 -0
- package/lib/typescript/src/useIsomorphicLayoutEffect.native.d.ts.map +1 -0
- 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 +4 -1
- package/lib/typescript/src/useNavigation.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationBuilder.d.ts +99 -63
- package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationCache.d.ts +53 -3
- 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 +26 -40
- 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 +2 -2
- package/lib/typescript/src/useOnAction.d.ts.map +1 -1
- package/lib/typescript/src/useOnGetState.d.ts +2 -2
- package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
- package/lib/typescript/src/useOnPreventRemove.d.ts +2 -2
- 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/useSyncState.d.ts +1 -4
- 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/lib/typescript/utils/usePrevious.d.ts +6 -0
- package/lib/typescript/utils/usePrevious.d.ts.map +1 -0
- package/package.json +14 -14
- package/src/BaseNavigationContainer.tsx +52 -55
- package/src/CurrentRenderContext.tsx +1 -3
- package/src/DeprecatedNavigationInChildContext.tsx +1 -3
- package/src/EnsureSingleNavigator.tsx +1 -1
- package/src/Group.tsx +2 -2
- 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 +7 -4
- package/src/SceneView.tsx +6 -6
- package/src/Screen.tsx +2 -2
- package/src/StaticContainer.tsx +19 -18
- package/src/StaticNavigation.tsx +35 -33
- package/src/UnhandledActionContext.tsx +1 -3
- package/src/checkDuplicateRouteNames.tsx +2 -2
- package/src/checkSerializable.tsx +1 -1
- package/src/createNavigationContainerRef.tsx +2 -2
- package/src/createNavigatorFactory.tsx +5 -7
- package/src/findFocusedRoute.tsx +1 -1
- package/src/getActionFromState.tsx +2 -2
- package/src/getFocusedRouteNameFromRoute.tsx +4 -4
- package/src/getPathFromState.tsx +16 -13
- package/src/getStateFromPath.tsx +25 -6
- package/src/index.tsx +33 -30
- package/src/isArrayEqual.tsx +1 -1
- package/src/isRecordEqual.tsx +1 -4
- package/src/theming/ThemeContext.tsx +7 -0
- package/src/theming/ThemeProvider.tsx +14 -0
- package/src/theming/useTheme.tsx +15 -0
- package/src/types.tsx +133 -17
- package/src/useChildListeners.tsx +1 -1
- package/src/useComponent.tsx +1 -1
- package/src/useCurrentRender.tsx +2 -6
- package/src/useDescriptors.tsx +161 -66
- package/src/useEventEmitter.tsx +1 -1
- package/src/useFocusEffect.tsx +3 -2
- package/src/useFocusEvents.tsx +2 -2
- package/src/useFocusedListenersChildrenAdapter.tsx +5 -4
- package/src/useIsFocused.tsx +2 -2
- package/src/useIsomorphicLayoutEffect.native.tsx +3 -0
- package/src/useIsomorphicLayoutEffect.tsx +7 -0
- package/src/useKeyedChildListeners.tsx +1 -1
- package/src/useNavigation.tsx +7 -4
- package/src/useNavigationBuilder.tsx +141 -122
- package/src/useNavigationCache.tsx +93 -32
- package/src/useNavigationContainerRef.tsx +3 -3
- package/src/useNavigationHelpers.tsx +9 -10
- package/src/useNavigationIndependentTree.tsx +2 -2
- package/src/useNavigationState.tsx +2 -2
- package/src/useOnAction.tsx +13 -7
- package/src/useOnGetState.tsx +6 -8
- package/src/useOnPreventRemove.tsx +5 -4
- package/src/useOnRouteFocus.tsx +2 -2
- package/src/useOptionsGetters.tsx +5 -9
- 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 +18 -17
- package/src/useSyncState.tsx +31 -59
- package/src/validatePathConfig.tsx +58 -14
- package/lib/commonjs/fromEntries.js +0 -18
- package/lib/commonjs/fromEntries.js.map +0 -1
- package/lib/commonjs/useScheduleUpdate.js +0 -37
- package/lib/commonjs/useScheduleUpdate.js.map +0 -1
- package/lib/module/fromEntries.js +0 -12
- package/lib/module/fromEntries.js.map +0 -1
- package/lib/module/useScheduleUpdate.js +0 -27
- package/lib/module/useScheduleUpdate.js.map +0 -1
- package/lib/typescript/src/fromEntries.d.ts +0 -2
- package/lib/typescript/src/fromEntries.d.ts.map +0 -1
- package/lib/typescript/src/useScheduleUpdate.d.ts +0 -14
- package/lib/typescript/src/useScheduleUpdate.d.ts.map +0 -1
- package/src/fromEntries.tsx +0 -13
- package/src/useScheduleUpdate.tsx +0 -32
package/src/types.tsx
CHANGED
|
@@ -14,6 +14,9 @@ declare global {
|
|
|
14
14
|
namespace ReactNavigation {
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
16
16
|
interface RootParamList {}
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
19
|
+
interface Theme {}
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -23,17 +26,44 @@ export type DefaultNavigatorOptions<
|
|
|
23
26
|
ParamList extends ParamListBase,
|
|
24
27
|
State extends NavigationState,
|
|
25
28
|
ScreenOptions extends {},
|
|
26
|
-
EventMap extends EventMapBase
|
|
29
|
+
EventMap extends EventMapBase,
|
|
27
30
|
> = DefaultRouterOptions<Keyof<ParamList>> & {
|
|
28
31
|
/**
|
|
29
32
|
* Optional ID for the navigator. Can be used with `navigation.getParent(id)` to refer to a parent.
|
|
30
33
|
*/
|
|
31
34
|
id?: string;
|
|
35
|
+
|
|
32
36
|
/**
|
|
33
37
|
* Children React Elements to extract the route configuration from.
|
|
34
38
|
* Only `Screen`, `Group` and `React.Fragment` are supported as children.
|
|
35
39
|
*/
|
|
36
40
|
children: React.ReactNode;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Layout for the navigator.
|
|
44
|
+
* Useful for wrapping with a component with access to navigator's state and options.
|
|
45
|
+
*/
|
|
46
|
+
layout?: (props: {
|
|
47
|
+
state: State;
|
|
48
|
+
navigation: NavigationHelpers<ParamList>;
|
|
49
|
+
descriptors: Record<
|
|
50
|
+
string,
|
|
51
|
+
Descriptor<
|
|
52
|
+
ScreenOptions,
|
|
53
|
+
NavigationProp<
|
|
54
|
+
ParamList,
|
|
55
|
+
keyof ParamList,
|
|
56
|
+
string | undefined,
|
|
57
|
+
State,
|
|
58
|
+
ScreenOptions,
|
|
59
|
+
EventMap
|
|
60
|
+
>,
|
|
61
|
+
RouteProp<ParamList>
|
|
62
|
+
>
|
|
63
|
+
>;
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
}) => React.ReactElement;
|
|
66
|
+
|
|
37
67
|
/**
|
|
38
68
|
* Event listeners for all the screens in the navigator.
|
|
39
69
|
*/
|
|
@@ -43,6 +73,7 @@ export type DefaultNavigatorOptions<
|
|
|
43
73
|
route: RouteProp<ParamList>;
|
|
44
74
|
navigation: any;
|
|
45
75
|
}) => ScreenListeners<State, EventMap>);
|
|
76
|
+
|
|
46
77
|
/**
|
|
47
78
|
* Default options for all screens under this navigator.
|
|
48
79
|
*/
|
|
@@ -51,7 +82,25 @@ export type DefaultNavigatorOptions<
|
|
|
51
82
|
| ((props: {
|
|
52
83
|
route: RouteProp<ParamList>;
|
|
53
84
|
navigation: any;
|
|
85
|
+
theme: ReactNavigation.Theme;
|
|
54
86
|
}) => ScreenOptions);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Layout for all screens under this navigator.
|
|
90
|
+
*/
|
|
91
|
+
screenLayout?: (props: {
|
|
92
|
+
route: RouteProp<ParamList, keyof ParamList>;
|
|
93
|
+
navigation: any;
|
|
94
|
+
theme: ReactNavigation.Theme;
|
|
95
|
+
children: React.ReactElement;
|
|
96
|
+
}) => React.ReactElement;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
A function returning a state, which may be set after modifying the routes name.
|
|
100
|
+
*/
|
|
101
|
+
getStateForRouteNamesChange?: (
|
|
102
|
+
state: NavigationState
|
|
103
|
+
) => PartialState<NavigationState> | undefined;
|
|
55
104
|
};
|
|
56
105
|
|
|
57
106
|
export type EventMapBase = Record<
|
|
@@ -69,7 +118,7 @@ export type EventMapCore<State extends NavigationState> = {
|
|
|
69
118
|
export type EventArg<
|
|
70
119
|
EventName extends string,
|
|
71
120
|
CanPreventDefault extends boolean | undefined = false,
|
|
72
|
-
Data = undefined
|
|
121
|
+
Data = undefined,
|
|
73
122
|
> = {
|
|
74
123
|
/**
|
|
75
124
|
* Type of the event (e.g. `focus`, `blur`)
|
|
@@ -94,7 +143,7 @@ export type EventArg<
|
|
|
94
143
|
|
|
95
144
|
export type EventListenerCallback<
|
|
96
145
|
EventMap extends EventMapBase,
|
|
97
|
-
EventName extends keyof EventMap
|
|
146
|
+
EventName extends keyof EventMap,
|
|
98
147
|
> = (
|
|
99
148
|
e: EventArg<
|
|
100
149
|
Extract<EventName, string>,
|
|
@@ -162,7 +211,7 @@ export class PrivateValueStore<T extends [any, any, any]> {
|
|
|
162
211
|
|
|
163
212
|
type NavigationHelpersCommon<
|
|
164
213
|
ParamList extends ParamListBase,
|
|
165
|
-
State extends NavigationState = NavigationState
|
|
214
|
+
State extends NavigationState = NavigationState,
|
|
166
215
|
> = {
|
|
167
216
|
/**
|
|
168
217
|
* Dispatch an action or an update function to the router.
|
|
@@ -251,6 +300,22 @@ type NavigationHelpersCommon<
|
|
|
251
300
|
: never
|
|
252
301
|
): void;
|
|
253
302
|
|
|
303
|
+
/**
|
|
304
|
+
* Preloads the route in current navigation tree.
|
|
305
|
+
*
|
|
306
|
+
* @param name Name of the route to navigate to.
|
|
307
|
+
* @param [params] Params object for the route.
|
|
308
|
+
*/
|
|
309
|
+
preload<RouteName extends keyof ParamList>(
|
|
310
|
+
...args: RouteName extends unknown
|
|
311
|
+
? undefined extends ParamList[RouteName]
|
|
312
|
+
?
|
|
313
|
+
| [screen: RouteName]
|
|
314
|
+
| [screen: RouteName, params: ParamList[RouteName]]
|
|
315
|
+
: [screen: RouteName, params: ParamList[RouteName]]
|
|
316
|
+
: never
|
|
317
|
+
): void;
|
|
318
|
+
|
|
254
319
|
/**
|
|
255
320
|
* Reset the navigation state to the provided state.
|
|
256
321
|
*
|
|
@@ -297,11 +362,18 @@ type NavigationHelpersCommon<
|
|
|
297
362
|
* Note that this method doesn't re-render screen when the result changes. So don't use it in `render`.
|
|
298
363
|
*/
|
|
299
364
|
getState(): State;
|
|
365
|
+
/**
|
|
366
|
+
* Schedules the given state to be used as navigation state when the list of screens defined in the navigator changes
|
|
367
|
+
* instead of automatically calculating the new state, e.g. due to conditional rendering or dynamically defining screens.
|
|
368
|
+
*
|
|
369
|
+
* @param state Navigation state object.
|
|
370
|
+
*/
|
|
371
|
+
setStateForNextRouteNamesChange(state: PartialState<State> | State): void;
|
|
300
372
|
} & PrivateValueStore<[ParamList, unknown, unknown]>;
|
|
301
373
|
|
|
302
374
|
export type NavigationHelpers<
|
|
303
375
|
ParamList extends ParamListBase,
|
|
304
|
-
EventMap extends EventMapBase = {}
|
|
376
|
+
EventMap extends EventMapBase = {},
|
|
305
377
|
> = NavigationHelpersCommon<ParamList> &
|
|
306
378
|
EventEmitter<EventMap> & {
|
|
307
379
|
/**
|
|
@@ -342,6 +414,10 @@ export type NavigationContainerProps = {
|
|
|
342
414
|
* @deprecated Use nested navigation API instead
|
|
343
415
|
*/
|
|
344
416
|
navigationInChildEnabled?: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Theme object for the UI elements.
|
|
419
|
+
*/
|
|
420
|
+
theme?: ReactNavigation.Theme;
|
|
345
421
|
/**
|
|
346
422
|
* Children elements to render.
|
|
347
423
|
*/
|
|
@@ -354,7 +430,7 @@ export type NavigationProp<
|
|
|
354
430
|
NavigatorID extends string | undefined = undefined,
|
|
355
431
|
State extends NavigationState = NavigationState<ParamList>,
|
|
356
432
|
ScreenOptions extends {} = {},
|
|
357
|
-
EventMap extends EventMapBase = {}
|
|
433
|
+
EventMap extends EventMapBase = {},
|
|
358
434
|
> = Omit<NavigationHelpersCommon<ParamList, State>, 'getParent'> & {
|
|
359
435
|
/**
|
|
360
436
|
* Returns the navigation prop from a parent navigator based on the ID.
|
|
@@ -389,12 +465,12 @@ export type NavigationProp<
|
|
|
389
465
|
|
|
390
466
|
export type RouteProp<
|
|
391
467
|
ParamList extends ParamListBase,
|
|
392
|
-
RouteName extends keyof ParamList = Keyof<ParamList
|
|
468
|
+
RouteName extends keyof ParamList = Keyof<ParamList>,
|
|
393
469
|
> = Route<Extract<RouteName, string>, ParamList[RouteName]>;
|
|
394
470
|
|
|
395
471
|
export type CompositeNavigationProp<
|
|
396
472
|
A extends NavigationProp<ParamListBase, string, any, any, any>,
|
|
397
|
-
B extends NavigationHelpersCommon<ParamListBase, any
|
|
473
|
+
B extends NavigationHelpersCommon<ParamListBase, any>,
|
|
398
474
|
> = Omit<A & B, keyof NavigationProp<any>> &
|
|
399
475
|
NavigationProp<
|
|
400
476
|
/**
|
|
@@ -442,7 +518,7 @@ export type CompositeScreenProps<
|
|
|
442
518
|
},
|
|
443
519
|
B extends {
|
|
444
520
|
navigation: NavigationHelpersCommon<any, any>;
|
|
445
|
-
}
|
|
521
|
+
},
|
|
446
522
|
> = {
|
|
447
523
|
navigation: CompositeNavigationProp<A['navigation'], B['navigation']>;
|
|
448
524
|
route: A['route'];
|
|
@@ -451,7 +527,7 @@ export type CompositeScreenProps<
|
|
|
451
527
|
export type Descriptor<
|
|
452
528
|
ScreenOptions extends {},
|
|
453
529
|
Navigation extends NavigationProp<any, any, any, any, any, any>,
|
|
454
|
-
Route extends RouteProp<any, any
|
|
530
|
+
Route extends RouteProp<any, any>,
|
|
455
531
|
> = {
|
|
456
532
|
/**
|
|
457
533
|
* Render the component associated with this route.
|
|
@@ -476,7 +552,7 @@ export type Descriptor<
|
|
|
476
552
|
|
|
477
553
|
export type ScreenListeners<
|
|
478
554
|
State extends NavigationState,
|
|
479
|
-
EventMap extends EventMapBase
|
|
555
|
+
EventMap extends EventMapBase,
|
|
480
556
|
> = Partial<{
|
|
481
557
|
[EventName in keyof (EventMap & EventMapCore<State>)]: EventListenerCallback<
|
|
482
558
|
EventMap,
|
|
@@ -486,7 +562,7 @@ export type ScreenListeners<
|
|
|
486
562
|
|
|
487
563
|
type ScreenComponentType<
|
|
488
564
|
ParamList extends ParamListBase,
|
|
489
|
-
RouteName extends keyof ParamList
|
|
565
|
+
RouteName extends keyof ParamList,
|
|
490
566
|
> =
|
|
491
567
|
| React.ComponentType<{
|
|
492
568
|
route: RouteProp<ParamList, RouteName>;
|
|
@@ -496,7 +572,7 @@ type ScreenComponentType<
|
|
|
496
572
|
|
|
497
573
|
export type RouteConfigComponent<
|
|
498
574
|
ParamList extends ParamListBase,
|
|
499
|
-
RouteName extends keyof ParamList
|
|
575
|
+
RouteName extends keyof ParamList,
|
|
500
576
|
> =
|
|
501
577
|
| {
|
|
502
578
|
/**
|
|
@@ -531,7 +607,7 @@ export type RouteConfig<
|
|
|
531
607
|
RouteName extends keyof ParamList,
|
|
532
608
|
State extends NavigationState,
|
|
533
609
|
ScreenOptions extends {},
|
|
534
|
-
EventMap extends EventMapBase
|
|
610
|
+
EventMap extends EventMapBase,
|
|
535
611
|
> = {
|
|
536
612
|
/**
|
|
537
613
|
* Optional key for this screen. This doesn't need to be unique.
|
|
@@ -553,6 +629,7 @@ export type RouteConfig<
|
|
|
553
629
|
| ((props: {
|
|
554
630
|
route: RouteProp<ParamList, RouteName>;
|
|
555
631
|
navigation: any;
|
|
632
|
+
theme: ReactNavigation.Theme;
|
|
556
633
|
}) => ScreenOptions);
|
|
557
634
|
|
|
558
635
|
/**
|
|
@@ -565,6 +642,18 @@ export type RouteConfig<
|
|
|
565
642
|
navigation: any;
|
|
566
643
|
}) => ScreenListeners<State, EventMap>);
|
|
567
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Layout for this screen.
|
|
647
|
+
* Useful for wrapping the screen with custom containers.
|
|
648
|
+
* e.g. for styling, error boundaries, suspense, etc.
|
|
649
|
+
*/
|
|
650
|
+
layout?: (props: {
|
|
651
|
+
route: RouteProp<ParamList, keyof ParamList>;
|
|
652
|
+
navigation: any;
|
|
653
|
+
theme: ReactNavigation.Theme;
|
|
654
|
+
children: React.ReactElement;
|
|
655
|
+
}) => React.ReactElement;
|
|
656
|
+
|
|
568
657
|
/**
|
|
569
658
|
* Function to return an unique ID for this screen.
|
|
570
659
|
* Receives an object with the route params.
|
|
@@ -585,7 +674,7 @@ export type RouteConfig<
|
|
|
585
674
|
|
|
586
675
|
export type RouteGroupConfig<
|
|
587
676
|
ParamList extends ParamListBase,
|
|
588
|
-
ScreenOptions extends {}
|
|
677
|
+
ScreenOptions extends {},
|
|
589
678
|
> = {
|
|
590
679
|
/**
|
|
591
680
|
* Optional key for the screens in this group.
|
|
@@ -601,7 +690,20 @@ export type RouteGroupConfig<
|
|
|
601
690
|
| ((props: {
|
|
602
691
|
route: RouteProp<ParamList, keyof ParamList>;
|
|
603
692
|
navigation: any;
|
|
693
|
+
theme: ReactNavigation.Theme;
|
|
604
694
|
}) => ScreenOptions);
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Layout for the screens inside the group.
|
|
698
|
+
* This will override the `screenLayout` of parent group or navigator.
|
|
699
|
+
*/
|
|
700
|
+
screenLayout?: (props: {
|
|
701
|
+
route: RouteProp<ParamList, keyof ParamList>;
|
|
702
|
+
navigation: any;
|
|
703
|
+
theme: ReactNavigation.Theme;
|
|
704
|
+
children: React.ReactElement;
|
|
705
|
+
}) => React.ReactElement;
|
|
706
|
+
|
|
605
707
|
/**
|
|
606
708
|
* Children React Elements to extract the route configuration from.
|
|
607
709
|
* Only `Screen`, `Group` and `React.Fragment` are supported as children.
|
|
@@ -673,6 +775,14 @@ export type NavigationContainerRef<ParamList extends {}> =
|
|
|
673
775
|
* Whether the navigation container is ready to handle actions.
|
|
674
776
|
*/
|
|
675
777
|
isReady(): boolean;
|
|
778
|
+
/**
|
|
779
|
+
* Stub function for setOptions on navigation object for use with useNavigation.
|
|
780
|
+
*/
|
|
781
|
+
setOptions(): never;
|
|
782
|
+
/**
|
|
783
|
+
* Stub function for getParent on navigation object for use with useNavigation.
|
|
784
|
+
*/
|
|
785
|
+
getParent(): undefined;
|
|
676
786
|
};
|
|
677
787
|
|
|
678
788
|
export type NavigationContainerRefWithCurrent<ParamList extends {}> =
|
|
@@ -685,7 +795,7 @@ export type TypedNavigator<
|
|
|
685
795
|
State extends NavigationState,
|
|
686
796
|
ScreenOptions extends {},
|
|
687
797
|
EventMap extends EventMapBase,
|
|
688
|
-
Navigator extends React.ComponentType<any
|
|
798
|
+
Navigator extends React.ComponentType<any>,
|
|
689
799
|
> = {
|
|
690
800
|
/**
|
|
691
801
|
* Navigator component which manages the child screens.
|
|
@@ -779,12 +889,18 @@ export type PathConfig<ParamList extends {}> = {
|
|
|
779
889
|
* Name of the initial route to use for the navigator when the path matches.
|
|
780
890
|
*/
|
|
781
891
|
initialRouteName?: keyof ParamList;
|
|
892
|
+
/**
|
|
893
|
+
* A function returning a state, which may be set after modifying the routes name.
|
|
894
|
+
*/
|
|
895
|
+
getStateForRouteNamesChange?: (
|
|
896
|
+
state: NavigationState
|
|
897
|
+
) => PartialState<NavigationState> | undefined;
|
|
782
898
|
};
|
|
783
899
|
|
|
784
900
|
export type PathConfigMap<ParamList extends {}> = {
|
|
785
901
|
[RouteName in keyof ParamList]?: NonNullable<
|
|
786
902
|
ParamList[RouteName]
|
|
787
|
-
> extends NavigatorScreenParams<infer T>
|
|
903
|
+
> extends NavigatorScreenParams<infer T extends {}>
|
|
788
904
|
? string | PathConfig<T>
|
|
789
905
|
: string | Omit<PathConfig<{}>, 'screens' | 'initialRouteName'>;
|
|
790
906
|
};
|
|
@@ -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()) {
|