@react-navigation/native 8.0.0-alpha.5 → 8.0.0-alpha.50
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/android/build.gradle +8 -7
- package/android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt +25 -10
- package/android/src/main/java/org/reactnavigation/MaterialSymbolTypeface.kt +71 -24
- package/android/src/main/java/org/reactnavigation/MaterialSymbolView.kt +24 -5
- package/android/src/main/java/org/reactnavigation/MaterialSymbolViewManager.kt +14 -7
- package/android/src/main/java/org/reactnavigation/ReactNavigationPackage.kt +3 -1
- package/assets/fonts/MaterialSymbolsOutlined.codepoints +190 -24
- package/assets/fonts/MaterialSymbolsOutlined_100.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_200.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_300.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_500.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_600.ttf +0 -0
- package/assets/fonts/MaterialSymbolsOutlined_700.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded.codepoints +190 -24
- package/assets/fonts/MaterialSymbolsRounded_100.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_200.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_300.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_400.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_500.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_600.ttf +0 -0
- package/assets/fonts/MaterialSymbolsRounded_700.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp.codepoints +190 -24
- package/assets/fonts/MaterialSymbolsSharp_100.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_200.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_300.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_400.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_500.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_600.ttf +0 -0
- package/assets/fonts/MaterialSymbolsSharp_700.ttf +0 -0
- package/ios/ReactNavigationCornerInsetView.h +14 -0
- package/ios/ReactNavigationCornerInsetView.mm +182 -0
- package/ios/ReactNavigationCornerInsetView.swift +193 -0
- package/ios/ReactNavigationCornerInsetViewComponentDescriptor.h +23 -0
- package/ios/ReactNavigationCornerInsetViewShadowNode.h +27 -0
- package/ios/ReactNavigationCornerInsetViewShadowNode.mm +42 -0
- package/ios/ReactNavigationCornerInsetViewState.h +19 -0
- package/ios/ReactNavigationSFSymbolView.mm +23 -10
- package/ios/ReactNavigationSFSymbolView.swift +355 -65
- package/lib/module/Link.js +80 -24
- package/lib/module/Link.js.map +1 -1
- package/lib/module/Link.native.js +72 -0
- package/lib/module/Link.native.js.map +1 -0
- package/lib/module/NavigationContainer.js +77 -33
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/__stubs__/createStackNavigator.js +11 -8
- package/lib/module/__stubs__/createStackNavigator.js.map +1 -1
- package/lib/module/checkSerializable.js +180 -0
- package/lib/module/checkSerializable.js.map +1 -0
- package/lib/module/constants.js +5 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/constants.native.js +6 -0
- package/lib/module/constants.native.js.map +1 -0
- package/lib/module/createMemoryHistory.js +27 -10
- package/lib/module/createMemoryHistory.js.map +1 -1
- package/lib/module/createStandardNavigationFactories.js +97 -0
- package/lib/module/createStandardNavigationFactories.js.map +1 -0
- package/lib/module/createStaticNavigation.js +7 -5
- package/lib/module/createStaticNavigation.js.map +1 -1
- package/lib/module/extractPathFromURL.js +2 -2
- package/lib/module/extractPathFromURL.js.map +1 -1
- package/lib/module/getStateBreadcrumb.js +37 -0
- package/lib/module/getStateBreadcrumb.js.map +1 -0
- package/lib/module/getStateFromHref.js +2 -2
- package/lib/module/getStateFromHref.js.map +1 -1
- package/lib/module/index.js +5 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/CornerInset.ios.js +69 -0
- package/lib/module/native/CornerInset.ios.js.map +1 -0
- package/lib/module/native/CornerInset.js +12 -0
- package/lib/module/native/CornerInset.js.map +1 -0
- package/lib/module/native/MaterialSymbol.android.js +7 -16
- package/lib/module/native/MaterialSymbol.android.js.map +1 -1
- package/lib/module/native/MaterialSymbol.js.map +1 -1
- package/lib/module/native/MaterialSymbolViewNativeComponent.ts +7 -4
- package/lib/module/native/ReactNavigationCornerInsetViewNativeComponent.ts +31 -0
- package/lib/module/native/SFSymbol.ios.js +37 -18
- package/lib/module/native/SFSymbol.ios.js.map +1 -1
- package/lib/module/native/SFSymbol.js.map +1 -1
- package/lib/module/native/SFSymbolViewNativeComponent.ts +31 -15
- package/lib/module/server/ServerContext.js.map +1 -0
- package/lib/module/server/index.js +21 -0
- package/lib/module/server/index.js.map +1 -0
- package/lib/module/theming/DarkTheme.js +5 -5
- package/lib/module/theming/DarkTheme.js.map +1 -1
- package/lib/module/theming/LightTheme.js +16 -0
- package/lib/module/theming/LightTheme.js.map +1 -0
- package/lib/module/theming/MaterialFallbackTheme.js +28 -0
- package/lib/module/theming/MaterialFallbackTheme.js.map +1 -0
- package/lib/module/theming/MaterialTheme.android.js +33 -0
- package/lib/module/theming/MaterialTheme.android.js.map +1 -0
- package/lib/module/theming/MaterialTheme.js +4 -0
- package/lib/module/theming/MaterialTheme.js.map +1 -0
- package/lib/module/theming/fonts.js +15 -54
- package/lib/module/theming/fonts.js.map +1 -1
- package/lib/module/theming/fonts.native.js +42 -0
- package/lib/module/theming/fonts.native.js.map +1 -0
- package/lib/module/useBackButton.js.map +1 -1
- package/lib/module/useBackButton.native.js +4 -1
- package/lib/module/useBackButton.native.js.map +1 -1
- package/lib/module/useDeepStableValue.js +12 -0
- package/lib/module/useDeepStableValue.js.map +1 -0
- package/lib/module/useDocumentTitle.js.map +1 -1
- package/lib/module/useLinkBuilder.js +17 -17
- package/lib/module/useLinkBuilder.js.map +1 -1
- package/lib/module/useLinkProps.js +143 -68
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/module/useLinkTo.js +5 -5
- package/lib/module/useLinkTo.js.map +1 -1
- package/lib/module/useLinking.js +268 -58
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +31 -12
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/module/useLocale.js +1 -1
- package/lib/module/useLocale.js.map +1 -1
- package/lib/module/useMemoArray.js +25 -0
- package/lib/module/useMemoArray.js.map +1 -0
- package/lib/module/useRoutePath.js +1 -1
- package/lib/module/useRoutePath.js.map +1 -1
- package/lib/module/useScrollToTop.js +6 -9
- package/lib/module/useScrollToTop.js.map +1 -1
- package/lib/module/useThenable.js +8 -6
- package/lib/module/useThenable.js.map +1 -1
- package/lib/typescript/src/Link.d.ts +17 -9
- package/lib/typescript/src/Link.d.ts.map +1 -1
- package/lib/typescript/src/Link.native.d.ts +4 -0
- package/lib/typescript/src/Link.native.d.ts.map +1 -0
- package/lib/typescript/src/LinkingContext.d.ts +2 -2
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
- package/lib/typescript/src/LocaleDirContext.d.ts +1 -1
- package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts +24 -13
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +6 -9
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/checkSerializable.d.ts +12 -0
- package/lib/typescript/src/checkSerializable.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +4 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/constants.native.d.ts +4 -0
- package/lib/typescript/src/constants.native.d.ts.map +1 -0
- package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
- package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -1
- package/lib/typescript/src/createStandardNavigationFactories.d.ts +33 -0
- package/lib/typescript/src/createStandardNavigationFactories.d.ts.map +1 -0
- package/lib/typescript/src/createStaticNavigation.d.ts +9 -9
- package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
- package/lib/typescript/src/getStateBreadcrumb.d.ts +3 -0
- package/lib/typescript/src/getStateBreadcrumb.d.ts.map +1 -0
- package/lib/typescript/src/getStateFromHref.d.ts +3 -3
- package/lib/typescript/src/getStateFromHref.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +16 -14
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/CornerInset.d.ts +32 -0
- package/lib/typescript/src/native/CornerInset.d.ts.map +1 -0
- package/lib/typescript/src/native/CornerInset.ios.d.ts +8 -0
- package/lib/typescript/src/native/CornerInset.ios.d.ts.map +1 -0
- package/lib/typescript/src/native/MaterialSymbol.android.d.ts +9 -4
- package/lib/typescript/src/native/MaterialSymbol.android.d.ts.map +1 -1
- package/lib/typescript/src/native/MaterialSymbol.d.ts +8 -3
- package/lib/typescript/src/native/MaterialSymbol.d.ts.map +1 -1
- package/lib/typescript/src/native/MaterialSymbolData.d.ts +1 -1
- package/lib/typescript/src/native/MaterialSymbolData.d.ts.map +1 -1
- package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts +3 -3
- package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/native/ReactNavigationCornerInsetViewNativeComponent.d.ts +14 -0
- package/lib/typescript/src/native/ReactNavigationCornerInsetViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/native/SFSymbol.d.ts +8 -3
- package/lib/typescript/src/native/SFSymbol.d.ts.map +1 -1
- package/lib/typescript/src/native/SFSymbol.ios.d.ts +9 -4
- package/lib/typescript/src/native/SFSymbol.ios.d.ts.map +1 -1
- package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts +27 -14
- package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/native/types.d.ts +241 -45
- package/lib/typescript/src/native/types.d.ts.map +1 -1
- package/lib/typescript/src/{ServerContext.d.ts → server/ServerContext.d.ts} +1 -4
- package/lib/typescript/src/server/ServerContext.d.ts.map +1 -0
- package/lib/typescript/src/server/index.d.ts +10 -0
- package/lib/typescript/src/server/index.d.ts.map +1 -0
- package/lib/typescript/src/theming/DarkTheme.d.ts +4 -38
- package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
- package/lib/typescript/src/theming/LightTheme.d.ts +30 -0
- package/lib/typescript/src/theming/LightTheme.d.ts.map +1 -0
- package/lib/typescript/src/theming/{DefaultTheme.d.ts → MaterialFallbackTheme.d.ts} +25 -30
- package/lib/typescript/src/theming/MaterialFallbackTheme.d.ts.map +1 -0
- package/lib/typescript/src/theming/MaterialTheme.android.d.ts +115 -0
- package/lib/typescript/src/theming/MaterialTheme.android.d.ts.map +1 -0
- package/lib/typescript/src/theming/MaterialTheme.d.ts +2 -0
- package/lib/typescript/src/theming/MaterialTheme.d.ts.map +1 -0
- package/lib/typescript/src/theming/fonts.d.ts +0 -34
- package/lib/typescript/src/theming/fonts.d.ts.map +1 -1
- package/lib/typescript/src/theming/fonts.native.d.ts +36 -0
- package/lib/typescript/src/theming/fonts.native.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +27 -21
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.d.ts +1 -1
- package/lib/typescript/src/useBackButton.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.native.d.ts.map +1 -1
- package/lib/typescript/src/useDeepStableValue.d.ts +2 -0
- package/lib/typescript/src/useDeepStableValue.d.ts.map +1 -0
- package/lib/typescript/src/useDocumentTitle.d.ts +2 -2
- package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
- package/lib/typescript/src/useLinkBuilder.d.ts +62 -70
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useLinkProps.d.ts +36 -12
- package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
- package/lib/typescript/src/useLinkTo.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.d.ts +7 -49
- package/lib/typescript/src/useLinking.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts +9 -83
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/lib/typescript/src/useLocale.d.ts +1 -1
- package/lib/typescript/src/useMemoArray.d.ts +2 -0
- package/lib/typescript/src/useMemoArray.d.ts.map +1 -0
- package/lib/typescript/src/useScrollToTop.d.ts +1 -4
- package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
- package/lib/typescript/src/useThenable.d.ts +1 -1
- package/lib/typescript/src/useThenable.d.ts.map +1 -1
- package/package.json +48 -23
- package/src/Link.native.tsx +69 -0
- package/src/Link.tsx +126 -37
- package/src/LinkingContext.tsx +1 -1
- package/src/NavigationContainer.tsx +139 -69
- package/src/__stubs__/createStackNavigator.tsx +20 -18
- package/src/checkSerializable.tsx +246 -0
- package/src/constants.native.tsx +10 -0
- package/src/constants.tsx +5 -0
- package/src/createMemoryHistory.tsx +32 -10
- package/src/createStandardNavigationFactories.tsx +217 -0
- package/src/createStaticNavigation.tsx +32 -31
- package/src/extractPathFromURL.tsx +5 -3
- package/src/getStateBreadcrumb.tsx +44 -0
- package/src/getStateFromHref.tsx +8 -3
- package/src/index.tsx +11 -2
- package/src/native/CornerInset.ios.tsx +87 -0
- package/src/native/CornerInset.tsx +44 -0
- package/src/native/MaterialSymbol.android.tsx +11 -22
- package/src/native/MaterialSymbol.tsx +7 -2
- package/src/native/MaterialSymbolData.tsx +166 -0
- package/src/native/MaterialSymbolViewNativeComponent.ts +7 -4
- package/src/native/ReactNavigationCornerInsetViewNativeComponent.ts +31 -0
- package/src/native/SFSymbol.ios.tsx +80 -18
- package/src/native/SFSymbol.tsx +7 -2
- package/src/native/SFSymbolViewNativeComponent.ts +31 -15
- package/src/native/types.tsx +297 -47
- package/src/{ServerContext.tsx → server/ServerContext.tsx} +1 -4
- package/src/server/index.tsx +19 -0
- package/src/theming/DarkTheme.tsx +4 -4
- package/src/theming/{DefaultTheme.tsx → LightTheme.tsx} +4 -4
- package/src/theming/MaterialFallbackTheme.tsx +29 -0
- package/src/theming/MaterialTheme.android.tsx +45 -0
- package/src/theming/MaterialTheme.tsx +4 -0
- package/src/theming/fonts.native.tsx +41 -0
- package/src/theming/fonts.tsx +15 -54
- package/src/types.tsx +52 -45
- package/src/useBackButton.native.tsx +2 -0
- package/src/useBackButton.tsx +2 -2
- package/src/useDeepStableValue.tsx +12 -0
- package/src/useDocumentTitle.tsx +2 -2
- package/src/useLinkBuilder.tsx +29 -25
- package/src/useLinkProps.tsx +371 -127
- package/src/useLinkTo.tsx +9 -8
- package/src/useLinking.native.tsx +70 -39
- package/src/useLinking.tsx +426 -87
- package/src/useLocale.tsx +1 -1
- package/src/useMemoArray.tsx +41 -0
- package/src/useRoutePath.tsx +1 -1
- package/src/useScrollToTop.tsx +21 -13
- package/src/useThenable.tsx +9 -7
- package/android/build/.transforms/586a73aab4c351d3f13dc604ca6964e8/results.bin +0 -1
- package/android/build/.transforms/586a73aab4c351d3f13dc604ca6964e8/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/results.bin +0 -1
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/BuildConfig.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$Companion.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$WhenMappings.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$getImageSource$1.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolTypeface.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolTypefaceResult.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolView.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolViewManager$Companion.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolViewManager.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/ReactNavigationPackage.dex +0 -0
- package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/generated/source/buildConfig/debug/org/reactnavigation/BuildConfig.java +0 -10
- package/android/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.java +0 -39
- package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.java +0 -45
- package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.java +0 -22
- package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.java +0 -81
- package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.java +0 -34
- package/android/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
- package/android/build/generated/source/codegen/jni/ReactNavigationSpec-generated.cpp +0 -32
- package/android/build/generated/source/codegen/jni/ReactNavigationSpec.h +0 -31
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ComponentDescriptors.cpp +0 -23
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ComponentDescriptors.h +0 -25
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/EventEmitters.cpp +0 -17
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/EventEmitters.h +0 -30
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/Props.cpp +0 -176
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/Props.h +0 -132
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ReactNavigationSpecJSI-generated.cpp +0 -31
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ReactNavigationSpecJSI.h +0 -71
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ShadowNodes.cpp +0 -18
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ShadowNodes.h +0 -43
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/States.cpp +0 -16
- package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/States.h +0 -22
- package/android/build/generated/source/codegen/schema.json +0 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -7
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +0 -1
- package/android/build/intermediates/assets/debug/mergeDebugAssets/fonts/MaterialSymbols.hash +0 -1
- package/android/build/intermediates/assets/debug/mergeDebugAssets/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/react-navigation_native_debug.kotlin_module +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/reactnavigation/BuildConfig.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +0 -2
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +0 -7
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +0 -7
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +0 -1
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +0 -1
- package/android/build/intermediates/react-navigation/fonts/MaterialSymbols.hash +0 -1
- package/android/build/intermediates/react-navigation/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/react-navigation_native_debug.kotlin_module +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$WhenMappings.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$getImageSource$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolTypeface.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolTypefaceResult.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolView.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolViewManager$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolViewManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/ReactNavigationPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +0 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ReactNavigationSFSymbolViewManagerDelegate.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ReactNavigationSFSymbolViewManagerInterface.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/react-navigation_native_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$WhenMappings.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$getImageSource$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolTypeface.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolTypefaceResult.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolView.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolViewManager$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolViewManager.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/ReactNavigationPackage.class +0 -0
- package/lib/module/ServerContainer.js +0 -55
- package/lib/module/ServerContainer.js.map +0 -1
- package/lib/module/ServerContext.js.map +0 -1
- package/lib/module/__stubs__/window.js +0 -75
- package/lib/module/__stubs__/window.js.map +0 -1
- package/lib/module/theming/DefaultTheme.js +0 -16
- package/lib/module/theming/DefaultTheme.js.map +0 -1
- package/lib/typescript/src/ServerContainer.d.ts +0 -14
- package/lib/typescript/src/ServerContainer.d.ts.map +0 -1
- package/lib/typescript/src/ServerContext.d.ts.map +0 -1
- package/lib/typescript/src/__stubs__/window.d.ts +0 -18
- package/lib/typescript/src/__stubs__/window.d.ts.map +0 -1
- package/lib/typescript/src/theming/DefaultTheme.d.ts.map +0 -1
- package/src/ServerContainer.tsx +0 -57
- package/src/__stubs__/window.tsx +0 -77
- /package/lib/module/{ServerContext.js → server/ServerContext.js} +0 -0
package/src/useLinking.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CommonActions,
|
|
2
3
|
findFocusedRoute,
|
|
3
4
|
getActionFromState as getActionFromStateDefault,
|
|
4
5
|
getPathFromState as getPathFromStateDefault,
|
|
@@ -6,27 +7,84 @@ import {
|
|
|
6
7
|
type NavigationContainerRef,
|
|
7
8
|
type NavigationState,
|
|
8
9
|
type ParamListBase,
|
|
10
|
+
type PartialState,
|
|
9
11
|
useNavigationIndependentTree,
|
|
10
12
|
} from '@react-navigation/core';
|
|
11
13
|
import isEqual from 'fast-deep-equal';
|
|
12
14
|
import * as React from 'react';
|
|
13
15
|
|
|
14
16
|
import { createMemoryHistory } from './createMemoryHistory';
|
|
15
|
-
import { ServerContext } from './ServerContext';
|
|
17
|
+
import { ServerContext } from './server/ServerContext';
|
|
16
18
|
import type { LinkingOptions } from './types';
|
|
17
19
|
import type { Thenable } from './useThenable';
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
* History delta already applied by the browser when handling `popstate`
|
|
23
|
+
* The value 'replace' means the delta is unknown, so we can only replace
|
|
24
|
+
*/
|
|
25
|
+
type PopStateDelta = number | 'replace';
|
|
26
|
+
|
|
27
|
+
const getRoutesUntilIndex = (state: NavigationState) =>
|
|
28
|
+
state.routes.slice(0, state.index + 1);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the state object to construct the path from.
|
|
32
|
+
*
|
|
33
|
+
* We use the root state as the base, and fallback to existing `route.state`.
|
|
34
|
+
* If a navigator mounts later, this ensures we don't remove it from URL.
|
|
35
|
+
* It could happen during suspense, hydration, conditional rendering etc.
|
|
36
|
+
*/
|
|
37
|
+
const getStateForPath = (
|
|
38
|
+
state: NavigationState | PartialState<NavigationState>,
|
|
39
|
+
fallbackState: NavigationState | PartialState<NavigationState> | undefined
|
|
40
|
+
): Omit<PartialState<NavigationState>, 'stale'> => {
|
|
41
|
+
const index = state.index ?? state.routes.length - 1;
|
|
42
|
+
const route = state.routes[index];
|
|
43
|
+
|
|
44
|
+
if (route == null) {
|
|
45
|
+
return state;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fallbackRoute = fallbackState?.routes[index];
|
|
49
|
+
|
|
50
|
+
if (
|
|
51
|
+
(fallbackRoute != null &&
|
|
52
|
+
'key' in fallbackRoute &&
|
|
53
|
+
typeof fallbackRoute?.key === 'string' &&
|
|
54
|
+
typeof route?.key === 'string' &&
|
|
55
|
+
fallbackRoute.key !== route.key) ||
|
|
56
|
+
route.name !== fallbackRoute?.name
|
|
57
|
+
) {
|
|
58
|
+
return state;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const childState = route.state
|
|
62
|
+
? getStateForPath(route.state, fallbackRoute.state)
|
|
63
|
+
: fallbackRoute.state;
|
|
64
|
+
|
|
65
|
+
if (route.state === childState) {
|
|
66
|
+
return state;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
...state,
|
|
71
|
+
routes: state.routes.map((item) =>
|
|
72
|
+
item === route ? { ...item, state: childState } : item
|
|
73
|
+
),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
20
76
|
|
|
21
77
|
/**
|
|
22
78
|
* Calculate total history length including both navigator history and route history
|
|
23
79
|
*/
|
|
24
80
|
const getTotalHistoryLength = (state: NavigationState): number => {
|
|
81
|
+
const routes = getRoutesUntilIndex(state);
|
|
82
|
+
|
|
25
83
|
const baseHistoryLength = state.history
|
|
26
84
|
? state.history.length
|
|
27
|
-
:
|
|
85
|
+
: routes.length;
|
|
28
86
|
|
|
29
|
-
const routeHistoryLength =
|
|
87
|
+
const routeHistoryLength = routes.reduce((acc, r) => {
|
|
30
88
|
return acc + (r.history ? r.history.length : 0);
|
|
31
89
|
}, 0);
|
|
32
90
|
|
|
@@ -51,6 +109,10 @@ const findMatchingState = <T extends NavigationState>(
|
|
|
51
109
|
const aRoute = a.routes[a.index];
|
|
52
110
|
const bRoute = b.routes[b.index];
|
|
53
111
|
|
|
112
|
+
if (aRoute == null || bRoute == null) {
|
|
113
|
+
return [a, b];
|
|
114
|
+
}
|
|
115
|
+
|
|
54
116
|
const aChildState = aRoute.state as T | undefined;
|
|
55
117
|
const bChildState = bRoute.state as T | undefined;
|
|
56
118
|
|
|
@@ -74,31 +136,107 @@ const findMatchingState = <T extends NavigationState>(
|
|
|
74
136
|
return findMatchingState(aChildState, bChildState);
|
|
75
137
|
};
|
|
76
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Calculate the history delta between 2 navigation states.
|
|
141
|
+
* If no common navigation state is found, only replace the history entry.
|
|
142
|
+
*/
|
|
143
|
+
const getHistoryDelta = (
|
|
144
|
+
previous: NavigationState | undefined,
|
|
145
|
+
next: NavigationState | undefined
|
|
146
|
+
): PopStateDelta => {
|
|
147
|
+
const [previousFocused, nextFocused] = findMatchingState(previous, next);
|
|
148
|
+
|
|
149
|
+
return previousFocused && nextFocused
|
|
150
|
+
? getTotalHistoryLength(nextFocused) -
|
|
151
|
+
getTotalHistoryLength(previousFocused)
|
|
152
|
+
: 'replace';
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Check if navigator history matches between committed and latest state.
|
|
157
|
+
*/
|
|
158
|
+
const hasMatchingBackHistory = (
|
|
159
|
+
current: NavigationState,
|
|
160
|
+
latest: NavigationState
|
|
161
|
+
): boolean => {
|
|
162
|
+
if (current.history !== undefined || latest.history !== undefined) {
|
|
163
|
+
return isEqual(current.history, latest.history);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return current.routes
|
|
167
|
+
.slice(0, Math.min(current.index, latest.index) + 1)
|
|
168
|
+
.every((route, i) => route.key === latest.routes[i]?.key);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Check if the state change is popping the last route or history entry.
|
|
173
|
+
*/
|
|
174
|
+
const isPoppingLastEntry = (
|
|
175
|
+
current: NavigationState,
|
|
176
|
+
record: NavigationState
|
|
177
|
+
): boolean => {
|
|
178
|
+
const currentRoute = current.routes[current.index];
|
|
179
|
+
const recordRoute = record.routes[record.index];
|
|
180
|
+
|
|
181
|
+
if (currentRoute == null || recordRoute == null) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const currentRouteHistory = currentRoute.history;
|
|
186
|
+
const recordRouteHistory = recordRoute.history ?? [];
|
|
187
|
+
|
|
188
|
+
if (currentRouteHistory?.length) {
|
|
189
|
+
return (
|
|
190
|
+
currentRoute.key === recordRoute.key &&
|
|
191
|
+
currentRouteHistory.length === recordRouteHistory.length + 1
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (current.history && record.history) {
|
|
196
|
+
return current.history.length === record.history.length + 1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const currentRoutes = getRoutesUntilIndex(current);
|
|
200
|
+
const recordRoutes = getRoutesUntilIndex(record);
|
|
201
|
+
|
|
202
|
+
if (currentRoutes.length === recordRoutes.length + 1) {
|
|
203
|
+
return recordRoutes.every((route, i) => {
|
|
204
|
+
const currentRoute = currentRoutes[i];
|
|
205
|
+
|
|
206
|
+
return currentRoute != null && route.key === currentRoute.key;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return false;
|
|
211
|
+
};
|
|
212
|
+
|
|
77
213
|
/**
|
|
78
214
|
* Run async function in series as it's called.
|
|
79
215
|
*/
|
|
80
|
-
|
|
216
|
+
const series = (cb: () => Promise<void>) => {
|
|
81
217
|
let queue = Promise.resolve();
|
|
218
|
+
|
|
82
219
|
const callback = () => {
|
|
83
220
|
// eslint-disable-next-line promise/no-callback-in-promise
|
|
84
|
-
queue = queue.then(cb)
|
|
221
|
+
queue = queue.then(cb).catch((e) => {
|
|
222
|
+
console.error(e);
|
|
223
|
+
});
|
|
85
224
|
};
|
|
225
|
+
|
|
86
226
|
return callback;
|
|
87
227
|
};
|
|
88
228
|
|
|
89
229
|
const linkingHandlers = new Set<symbol>();
|
|
90
230
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
export function useLinking(
|
|
94
|
-
ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>,
|
|
231
|
+
export function useLinking<ParamList extends ParamListBase>(
|
|
232
|
+
ref: React.RefObject<NavigationContainerRef<ParamList> | null>,
|
|
95
233
|
{
|
|
96
234
|
enabled = true,
|
|
97
235
|
config,
|
|
98
236
|
getStateFromPath = getStateFromPathDefault,
|
|
99
237
|
getPathFromState = getPathFromStateDefault,
|
|
100
238
|
getActionFromState = getActionFromStateDefault,
|
|
101
|
-
}:
|
|
239
|
+
}: LinkingOptions<ParamList>
|
|
102
240
|
) {
|
|
103
241
|
const independent = useNavigationIndependentTree();
|
|
104
242
|
|
|
@@ -134,7 +272,15 @@ export function useLinking(
|
|
|
134
272
|
};
|
|
135
273
|
}, [enabled, independent]);
|
|
136
274
|
|
|
137
|
-
const
|
|
275
|
+
const server = React.use(ServerContext);
|
|
276
|
+
|
|
277
|
+
const [history] = React.useState(() => {
|
|
278
|
+
if (server || typeof window === 'undefined') {
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return createMemoryHistory();
|
|
283
|
+
});
|
|
138
284
|
|
|
139
285
|
// We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners
|
|
140
286
|
// This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`
|
|
@@ -154,34 +300,41 @@ export function useLinking(
|
|
|
154
300
|
});
|
|
155
301
|
|
|
156
302
|
const validateRoutesNotExistInRootState = React.useCallback(
|
|
157
|
-
(
|
|
158
|
-
|
|
159
|
-
|
|
303
|
+
(
|
|
304
|
+
state: PartialState<NavigationState> | undefined,
|
|
305
|
+
rootState: NavigationState | undefined
|
|
306
|
+
) => {
|
|
160
307
|
// Make sure that the routes in the state exist in the root navigator
|
|
161
308
|
// Otherwise there's an error in the linking configuration
|
|
162
309
|
return state?.routes.some((r) => !rootState?.routeNames.includes(r.name));
|
|
163
310
|
},
|
|
164
|
-
[
|
|
311
|
+
[]
|
|
165
312
|
);
|
|
166
313
|
|
|
167
|
-
const server = React.useContext(ServerContext);
|
|
168
|
-
|
|
169
314
|
const getInitialState = React.useCallback(() => {
|
|
170
|
-
let value:
|
|
315
|
+
let value: PartialState<NavigationState> | undefined;
|
|
171
316
|
|
|
172
317
|
if (enabledRef.current) {
|
|
173
|
-
const location =
|
|
174
|
-
server
|
|
175
|
-
|
|
318
|
+
const location = server
|
|
319
|
+
? server.location
|
|
320
|
+
: typeof window !== 'undefined'
|
|
321
|
+
? window.location
|
|
322
|
+
: undefined;
|
|
176
323
|
|
|
177
324
|
const path = location ? location.pathname + location.search : undefined;
|
|
178
325
|
|
|
179
326
|
if (path) {
|
|
180
|
-
|
|
327
|
+
try {
|
|
328
|
+
value = getStateFromPathRef.current(path, configRef.current);
|
|
329
|
+
} catch (e) {
|
|
330
|
+
console.error(e);
|
|
331
|
+
|
|
332
|
+
value = undefined;
|
|
333
|
+
}
|
|
181
334
|
}
|
|
182
335
|
}
|
|
183
336
|
|
|
184
|
-
const thenable: Thenable<
|
|
337
|
+
const thenable: Thenable<PartialState<NavigationState> | undefined> = {
|
|
185
338
|
then(onfulfilled) {
|
|
186
339
|
return Promise.resolve(onfulfilled ? onfulfilled(value) : value);
|
|
187
340
|
},
|
|
@@ -193,9 +346,15 @@ export function useLinking(
|
|
|
193
346
|
|
|
194
347
|
const previousIndexRef = React.useRef<number | undefined>(undefined);
|
|
195
348
|
const previousStateRef = React.useRef<NavigationState | undefined>(undefined);
|
|
196
|
-
const
|
|
349
|
+
const pendingPopStateRef = React.useRef<
|
|
350
|
+
{ state: NavigationState | undefined; delta: PopStateDelta } | undefined
|
|
351
|
+
>(undefined);
|
|
197
352
|
|
|
198
353
|
React.useEffect(() => {
|
|
354
|
+
if (!history) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
199
358
|
previousIndexRef.current = history.index;
|
|
200
359
|
|
|
201
360
|
return history.listen(() => {
|
|
@@ -213,7 +372,91 @@ export function useLinking(
|
|
|
213
372
|
const previousIndex = previousIndexRef.current ?? 0;
|
|
214
373
|
|
|
215
374
|
previousIndexRef.current = index;
|
|
216
|
-
|
|
375
|
+
|
|
376
|
+
const rollbackHistory = () => {
|
|
377
|
+
const delta = previousIndex - index;
|
|
378
|
+
|
|
379
|
+
if (delta === 0) {
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
history
|
|
384
|
+
.go(delta)
|
|
385
|
+
// eslint-disable-next-line promise/always-return
|
|
386
|
+
?.then(() => {
|
|
387
|
+
previousIndexRef.current = history.index;
|
|
388
|
+
})
|
|
389
|
+
.catch(() => {
|
|
390
|
+
// The navigation was interrupted
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
const rollbackHistoryIfPrevented = (
|
|
395
|
+
callback: () => void,
|
|
396
|
+
pendingDelta: PopStateDelta
|
|
397
|
+
) => {
|
|
398
|
+
let removePrevented = false;
|
|
399
|
+
let actionChangedState = false;
|
|
400
|
+
|
|
401
|
+
const unsubscribeEvent = navigation.addListener(
|
|
402
|
+
'__unsafe_event__',
|
|
403
|
+
(e) => {
|
|
404
|
+
if (e.data.type === 'beforeRemove' && e.data.defaultPrevented) {
|
|
405
|
+
removePrevented = true;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
// After preventing remove, user may synchronously continue navigation
|
|
411
|
+
// This is common when showing a confirmation dialog
|
|
412
|
+
// If this action produces an update, we don't want to rollback the history
|
|
413
|
+
const unsubscribeAction = navigation.addListener(
|
|
414
|
+
'__unsafe_action__',
|
|
415
|
+
(e) => {
|
|
416
|
+
if (!e.data.noop) {
|
|
417
|
+
actionChangedState = true;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
try {
|
|
423
|
+
callback();
|
|
424
|
+
} finally {
|
|
425
|
+
unsubscribeEvent();
|
|
426
|
+
unsubscribeAction();
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (actionChangedState) {
|
|
430
|
+
// The change may be committed later, e.g. with transitions
|
|
431
|
+
// Remember the delta so it can be subtracted when syncing the commit
|
|
432
|
+
pendingPopStateRef.current = {
|
|
433
|
+
state: navigation.getRootState(),
|
|
434
|
+
delta: pendingDelta,
|
|
435
|
+
};
|
|
436
|
+
} else if (removePrevented) {
|
|
437
|
+
rollbackHistory();
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
const dispatch = (
|
|
442
|
+
action: Parameters<typeof navigation.dispatch>[0],
|
|
443
|
+
pendingDelta: PopStateDelta
|
|
444
|
+
) => {
|
|
445
|
+
rollbackHistoryIfPrevented(
|
|
446
|
+
() => navigation.dispatch(action),
|
|
447
|
+
pendingDelta
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
const resetRoot = (
|
|
452
|
+
state: Parameters<typeof navigation.resetRoot>[0],
|
|
453
|
+
pendingDelta: PopStateDelta
|
|
454
|
+
) => {
|
|
455
|
+
rollbackHistoryIfPrevented(
|
|
456
|
+
() => navigation.resetRoot(state),
|
|
457
|
+
pendingDelta
|
|
458
|
+
);
|
|
459
|
+
};
|
|
217
460
|
|
|
218
461
|
// When browser back/forward is clicked, we first need to check if state object for this index exists
|
|
219
462
|
// If it does we'll reset to that state object
|
|
@@ -221,72 +464,157 @@ export function useLinking(
|
|
|
221
464
|
const record = history.get(index);
|
|
222
465
|
|
|
223
466
|
if (record?.path === path && record?.state) {
|
|
224
|
-
|
|
467
|
+
const pending = pendingPopStateRef.current;
|
|
468
|
+
|
|
469
|
+
// Use the state synced to browser history or the result of a pending traversal,
|
|
470
|
+
// since the store may already contain another navigation that hasn't committed yet.
|
|
471
|
+
const currentState = pending?.state ?? previousStateRef.current;
|
|
472
|
+
|
|
473
|
+
const [currentFocused, recordFocused] = findMatchingState(
|
|
474
|
+
currentState,
|
|
475
|
+
record.state
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
const [latestFocused] = findMatchingState(
|
|
479
|
+
navigation.getRootState(),
|
|
480
|
+
record.state
|
|
481
|
+
);
|
|
482
|
+
|
|
483
|
+
const [pendingFocused] = findMatchingState(
|
|
484
|
+
previousStateRef.current,
|
|
485
|
+
pending?.state
|
|
486
|
+
);
|
|
487
|
+
|
|
488
|
+
const currentRoute = currentFocused?.routes[currentFocused.index];
|
|
489
|
+
const latestRoute =
|
|
490
|
+
latestFocused &&
|
|
491
|
+
getRoutesUntilIndex(latestFocused).find(
|
|
492
|
+
(route) => route.key === currentRoute?.key
|
|
493
|
+
);
|
|
494
|
+
|
|
495
|
+
if (
|
|
496
|
+
previousIndex - index === 1 &&
|
|
497
|
+
currentFocused &&
|
|
498
|
+
recordFocused &&
|
|
499
|
+
latestFocused &&
|
|
500
|
+
currentFocused.key === latestFocused.key &&
|
|
501
|
+
// Only combine pending browser history deltas within the same navigator,
|
|
502
|
+
// as history lengths from different navigators aren't comparable.
|
|
503
|
+
(!pending?.state || pendingFocused?.key === currentFocused.key) &&
|
|
504
|
+
// We don't want to dispatch `goBack` if route history has grown since,
|
|
505
|
+
// as we can't specify the entry to go back from.
|
|
506
|
+
// We can only specify route to go back from with `source`.
|
|
507
|
+
// Entries removed since are fine, they were already popped by a back action.
|
|
508
|
+
(latestRoute?.history?.length ?? 0) <=
|
|
509
|
+
(currentRoute?.history?.length ?? 0) &&
|
|
510
|
+
hasMatchingBackHistory(currentFocused, latestFocused) &&
|
|
511
|
+
isPoppingLastEntry(currentFocused, recordFocused)
|
|
512
|
+
) {
|
|
513
|
+
// If we detect that the state change is popping the last entry
|
|
514
|
+
// Dispatch a back action instead of resetting to the state
|
|
515
|
+
// This makes sure changes to history state since the entry was added don't get lost
|
|
516
|
+
dispatch(
|
|
517
|
+
{
|
|
518
|
+
...CommonActions.goBack(),
|
|
519
|
+
target: currentFocused.key,
|
|
520
|
+
// If another back action already removed the source, go back
|
|
521
|
+
// from the current route in the same navigator instead.
|
|
522
|
+
source: latestRoute?.key,
|
|
523
|
+
},
|
|
524
|
+
// Stack on any delta from a previous `popstate` that hasn't committed yet
|
|
525
|
+
pending?.delta === 'replace' ? 'replace' : (pending?.delta ?? 0) - 1
|
|
526
|
+
);
|
|
527
|
+
} else {
|
|
528
|
+
// The browser already moved from the current state to the record's state
|
|
529
|
+
// We measure the delta from the last synced state,
|
|
530
|
+
// since that's what the pending delta gets subtracted from when syncing the commit
|
|
531
|
+
resetRoot(
|
|
532
|
+
record.state,
|
|
533
|
+
getHistoryDelta(previousStateRef.current, record.state)
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
225
537
|
return;
|
|
226
538
|
}
|
|
227
539
|
|
|
228
|
-
const
|
|
540
|
+
const rootState = navigation.getRootState();
|
|
541
|
+
|
|
542
|
+
let state: PartialState<NavigationState> | undefined;
|
|
543
|
+
|
|
544
|
+
try {
|
|
545
|
+
state = getStateFromPathRef.current(path, configRef.current, rootState);
|
|
546
|
+
} catch (e) {
|
|
547
|
+
console.error(e);
|
|
548
|
+
|
|
549
|
+
state = undefined;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Make sure that the routes in the state exist in the root navigator
|
|
553
|
+
// Otherwise there's an error in the linking configuration
|
|
554
|
+
if (state && validateRoutesNotExistInRootState(state, rootState)) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
229
557
|
|
|
230
558
|
// We should only dispatch an action when going forward
|
|
231
559
|
// Otherwise the action will likely add items to history, which would mess things up
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
560
|
+
const action =
|
|
561
|
+
state && index > previousIndex
|
|
562
|
+
? getActionFromStateRef.current(state, configRef.current)
|
|
563
|
+
: undefined;
|
|
564
|
+
|
|
565
|
+
if (action !== undefined) {
|
|
566
|
+
try {
|
|
567
|
+
dispatch(
|
|
568
|
+
{
|
|
569
|
+
target: rootState?.key,
|
|
570
|
+
...action,
|
|
571
|
+
},
|
|
572
|
+
'replace'
|
|
573
|
+
);
|
|
574
|
+
} catch (e) {
|
|
575
|
+
// Ignore any errors from deep linking.
|
|
576
|
+
// This could happen in case of malformed links, navigation object not being initialized etc.
|
|
577
|
+
console.warn(
|
|
578
|
+
`An error occurred when trying to handle the link '${path}': ${
|
|
579
|
+
typeof e === 'object' && e != null && 'message' in e
|
|
580
|
+
? e.message
|
|
581
|
+
: e
|
|
582
|
+
}`
|
|
243
583
|
);
|
|
244
|
-
|
|
245
|
-
if (action !== undefined) {
|
|
246
|
-
try {
|
|
247
|
-
navigation.dispatch(action);
|
|
248
|
-
} catch (e) {
|
|
249
|
-
// Ignore any errors from deep linking.
|
|
250
|
-
// This could happen in case of malformed links, navigation object not being initialized etc.
|
|
251
|
-
console.warn(
|
|
252
|
-
`An error occurred when trying to handle the link '${path}': ${
|
|
253
|
-
typeof e === 'object' && e != null && 'message' in e
|
|
254
|
-
? e.message
|
|
255
|
-
: e
|
|
256
|
-
}`
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
navigation.resetRoot(state);
|
|
261
|
-
}
|
|
262
|
-
} else {
|
|
263
|
-
navigation.resetRoot(state);
|
|
264
584
|
}
|
|
265
585
|
} else {
|
|
266
|
-
//
|
|
267
|
-
|
|
586
|
+
// If current path didn't return any state, we should revert to initial state
|
|
587
|
+
resetRoot(state, 'replace');
|
|
268
588
|
}
|
|
269
589
|
});
|
|
270
590
|
}, [enabled, history, ref, validateRoutesNotExistInRootState]);
|
|
271
591
|
|
|
272
592
|
React.useEffect(() => {
|
|
273
|
-
if (!enabled) {
|
|
593
|
+
if (!enabled || !history) {
|
|
274
594
|
return;
|
|
275
595
|
}
|
|
276
596
|
|
|
277
597
|
const getPathForRoute = (
|
|
278
598
|
route: ReturnType<typeof findFocusedRoute>,
|
|
279
|
-
state: NavigationState
|
|
599
|
+
state: NavigationState | PartialState<NavigationState>
|
|
280
600
|
): string => {
|
|
281
601
|
let path;
|
|
282
602
|
|
|
283
603
|
// If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match
|
|
284
604
|
// This makes sure that we preserve the original URL for wildcard routes
|
|
285
605
|
if (route?.path) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
606
|
+
let stateForPath: PartialState<NavigationState> | undefined;
|
|
607
|
+
|
|
608
|
+
try {
|
|
609
|
+
stateForPath = getStateFromPathRef.current(
|
|
610
|
+
route.path,
|
|
611
|
+
configRef.current
|
|
612
|
+
);
|
|
613
|
+
} catch (e) {
|
|
614
|
+
console.error(e);
|
|
615
|
+
|
|
616
|
+
stateForPath = undefined;
|
|
617
|
+
}
|
|
290
618
|
|
|
291
619
|
if (stateForPath) {
|
|
292
620
|
const focusedRoute = findFocusedRoute(stateForPath);
|
|
@@ -329,18 +657,21 @@ export function useLinking(
|
|
|
329
657
|
const state = ref.current.getRootState();
|
|
330
658
|
|
|
331
659
|
if (state) {
|
|
332
|
-
const
|
|
333
|
-
|
|
660
|
+
const stateForPath = getStateForPath(state, ref.current.getState());
|
|
661
|
+
|
|
662
|
+
const route = findFocusedRoute(stateForPath);
|
|
663
|
+
const path = getPathForRoute(route, stateForPath);
|
|
334
664
|
|
|
335
665
|
if (previousStateRef.current === undefined) {
|
|
336
666
|
previousStateRef.current = state;
|
|
337
667
|
}
|
|
338
668
|
|
|
339
669
|
history.replace({ path, state });
|
|
670
|
+
previousIndexRef.current = history.index;
|
|
340
671
|
}
|
|
341
672
|
}
|
|
342
673
|
|
|
343
|
-
const
|
|
674
|
+
const onUpdate = async () => {
|
|
344
675
|
const navigation = ref.current;
|
|
345
676
|
|
|
346
677
|
if (!navigation || !enabled) {
|
|
@@ -355,32 +686,36 @@ export function useLinking(
|
|
|
355
686
|
return;
|
|
356
687
|
}
|
|
357
688
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
689
|
+
// Skip if the state hasn't changed since we last synced it
|
|
690
|
+
if (previousState === state) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
const stateForPath = getStateForPath(state, navigation.getState());
|
|
695
|
+
|
|
696
|
+
const route = findFocusedRoute(stateForPath);
|
|
697
|
+
const path = getPathForRoute(route, stateForPath);
|
|
698
|
+
|
|
699
|
+
const pendingPopStateDelta = pendingPopStateRef.current?.delta;
|
|
361
700
|
|
|
362
701
|
previousStateRef.current = state;
|
|
363
|
-
|
|
702
|
+
pendingPopStateRef.current = undefined;
|
|
364
703
|
|
|
365
704
|
// To detect the kind of state change, we need to:
|
|
366
705
|
// - Find the common focused navigation state in previous and current state
|
|
367
706
|
// - If only the route keys changed, compare history/routes.length to check if we go back/forward/replace
|
|
368
707
|
// - If no common focused navigation state found, it's a replace
|
|
369
|
-
const
|
|
370
|
-
previousState,
|
|
371
|
-
state
|
|
372
|
-
);
|
|
708
|
+
const delta = getHistoryDelta(previousState, state);
|
|
373
709
|
|
|
374
710
|
if (
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
// Otherwise it's likely a change triggered by `popstate`
|
|
379
|
-
path !== pendingPath
|
|
711
|
+
delta !== 'replace' &&
|
|
712
|
+
// If the delta from `popstate` is unknown, we can only replace
|
|
713
|
+
pendingPopStateDelta !== 'replace'
|
|
380
714
|
) {
|
|
381
715
|
const historyDelta =
|
|
382
|
-
|
|
383
|
-
|
|
716
|
+
delta -
|
|
717
|
+
// Subtract the delta already applied by the browser to sync only the remaining changes
|
|
718
|
+
(pendingPopStateDelta ?? 0);
|
|
384
719
|
|
|
385
720
|
if (historyDelta > 0) {
|
|
386
721
|
// If history length is increased, we should pushState
|
|
@@ -422,12 +757,16 @@ export function useLinking(
|
|
|
422
757
|
// This would happen if the user did a reset/conditionally changed navigators
|
|
423
758
|
history.replace({ path, state });
|
|
424
759
|
}
|
|
760
|
+
|
|
761
|
+
previousIndexRef.current = history.index;
|
|
425
762
|
};
|
|
426
763
|
|
|
427
|
-
// We debounce
|
|
764
|
+
// We debounce onUpdate coz we don't want multiple state changes to be handled at one time
|
|
428
765
|
// This could happen since `history.go(n)` is asynchronous
|
|
429
766
|
// If `pushState` or `replaceState` were called before `history.go(n)` completes, it'll mess stuff up
|
|
430
|
-
|
|
767
|
+
const handleUpdate = series(onUpdate);
|
|
768
|
+
|
|
769
|
+
return ref.current?.addListener('state', handleUpdate);
|
|
431
770
|
}, [enabled, history, ref]);
|
|
432
771
|
|
|
433
772
|
return {
|
package/src/useLocale.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { LocaleDirContext } from './LocaleDirContext';
|
|
|
6
6
|
* Hook to access the text direction specified in the `NavigationContainer`.
|
|
7
7
|
*/
|
|
8
8
|
export function useLocale() {
|
|
9
|
-
const direction = React.
|
|
9
|
+
const direction = React.use(LocaleDirContext);
|
|
10
10
|
|
|
11
11
|
if (direction === undefined) {
|
|
12
12
|
throw new Error(
|