@react-navigation/native 8.0.0-alpha.3 → 8.0.0-alpha.30

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.
Files changed (416) hide show
  1. package/android/build.gradle +80 -6
  2. package/android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt +33 -12
  3. package/android/src/main/java/org/reactnavigation/MaterialSymbolTypeface.kt +81 -8
  4. package/android/src/main/java/org/reactnavigation/MaterialSymbolView.kt +39 -6
  5. package/android/src/main/java/org/reactnavigation/MaterialSymbolViewManager.kt +14 -7
  6. package/android/src/main/java/org/reactnavigation/ReactNavigationPackage.kt +3 -1
  7. package/assets/fonts/MaterialSymbolsOutlined_100.ttf +0 -0
  8. package/assets/fonts/MaterialSymbolsOutlined_200.ttf +0 -0
  9. package/assets/fonts/MaterialSymbolsOutlined_300.ttf +0 -0
  10. package/assets/fonts/MaterialSymbolsOutlined_500.ttf +0 -0
  11. package/assets/fonts/MaterialSymbolsOutlined_600.ttf +0 -0
  12. package/assets/fonts/MaterialSymbolsOutlined_700.ttf +0 -0
  13. package/assets/fonts/MaterialSymbolsRounded.codepoints +4102 -0
  14. package/assets/fonts/MaterialSymbolsRounded_100.ttf +0 -0
  15. package/assets/fonts/MaterialSymbolsRounded_200.ttf +0 -0
  16. package/assets/fonts/MaterialSymbolsRounded_300.ttf +0 -0
  17. package/assets/fonts/MaterialSymbolsRounded_400.ttf +0 -0
  18. package/assets/fonts/MaterialSymbolsRounded_500.ttf +0 -0
  19. package/assets/fonts/MaterialSymbolsRounded_600.ttf +0 -0
  20. package/assets/fonts/MaterialSymbolsRounded_700.ttf +0 -0
  21. package/assets/fonts/MaterialSymbolsSharp.codepoints +4102 -0
  22. package/assets/fonts/MaterialSymbolsSharp_100.ttf +0 -0
  23. package/assets/fonts/MaterialSymbolsSharp_200.ttf +0 -0
  24. package/assets/fonts/MaterialSymbolsSharp_300.ttf +0 -0
  25. package/assets/fonts/MaterialSymbolsSharp_400.ttf +0 -0
  26. package/assets/fonts/MaterialSymbolsSharp_500.ttf +0 -0
  27. package/assets/fonts/MaterialSymbolsSharp_600.ttf +0 -0
  28. package/assets/fonts/MaterialSymbolsSharp_700.ttf +0 -0
  29. package/ios/ReactNavigationCornerInsetView.h +14 -0
  30. package/ios/ReactNavigationCornerInsetView.mm +182 -0
  31. package/ios/ReactNavigationCornerInsetView.swift +193 -0
  32. package/ios/ReactNavigationCornerInsetViewComponentDescriptor.h +23 -0
  33. package/ios/ReactNavigationCornerInsetViewShadowNode.h +27 -0
  34. package/ios/ReactNavigationCornerInsetViewShadowNode.mm +42 -0
  35. package/ios/ReactNavigationCornerInsetViewState.h +19 -0
  36. package/ios/ReactNavigationSFSymbolView.mm +34 -0
  37. package/ios/ReactNavigationSFSymbolView.swift +543 -7
  38. package/lib/module/NavigationContainer.js +16 -11
  39. package/lib/module/NavigationContainer.js.map +1 -1
  40. package/lib/module/__stubs__/createStackNavigator.js +10 -4
  41. package/lib/module/__stubs__/createStackNavigator.js.map +1 -1
  42. package/lib/module/__stubs__/window.js +3 -0
  43. package/lib/module/__stubs__/window.js.map +1 -1
  44. package/lib/module/createMemoryHistory.js +15 -6
  45. package/lib/module/createMemoryHistory.js.map +1 -1
  46. package/lib/module/createStandardNavigationFactories.js +99 -0
  47. package/lib/module/createStandardNavigationFactories.js.map +1 -0
  48. package/lib/module/createStaticNavigation.js +5 -4
  49. package/lib/module/createStaticNavigation.js.map +1 -1
  50. package/lib/module/extractPathFromURL.js +2 -2
  51. package/lib/module/extractPathFromURL.js.map +1 -1
  52. package/lib/module/getStateFromHref.js +2 -2
  53. package/lib/module/getStateFromHref.js.map +1 -1
  54. package/lib/module/index.js +4 -2
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/native/CornerInset.ios.js +66 -0
  57. package/lib/module/native/CornerInset.ios.js.map +1 -0
  58. package/lib/module/native/CornerInset.js +17 -0
  59. package/lib/module/native/CornerInset.js.map +1 -0
  60. package/lib/module/native/MaterialSymbol.android.js +9 -20
  61. package/lib/module/native/MaterialSymbol.android.js.map +1 -1
  62. package/lib/module/native/MaterialSymbolData.js +0 -7
  63. package/lib/module/native/MaterialSymbolData.js.map +1 -1
  64. package/lib/module/native/MaterialSymbolViewNativeComponent.ts +4 -4
  65. package/lib/module/native/NativeMaterialSymbolModule.js.map +1 -1
  66. package/lib/module/native/ReactNavigationCornerInsetViewNativeComponent.ts +32 -0
  67. package/lib/module/native/SFSymbol.ios.js +45 -1
  68. package/lib/module/native/SFSymbol.ios.js.map +1 -1
  69. package/lib/module/native/SFSymbolViewNativeComponent.ts +28 -1
  70. package/lib/module/native/constants.js +14 -0
  71. package/lib/module/native/constants.js.map +1 -0
  72. package/lib/module/server/ServerContext.js.map +1 -0
  73. package/lib/module/server/index.js +21 -0
  74. package/lib/module/server/index.js.map +1 -0
  75. package/lib/module/theming/DarkTheme.js +4 -4
  76. package/lib/module/theming/{DefaultTheme.js → LightTheme.js} +5 -5
  77. package/lib/module/theming/LightTheme.js.map +1 -0
  78. package/lib/module/theming/MaterialFallbackTheme.js +28 -0
  79. package/lib/module/theming/MaterialFallbackTheme.js.map +1 -0
  80. package/lib/module/theming/MaterialTheme.android.js +33 -0
  81. package/lib/module/theming/MaterialTheme.android.js.map +1 -0
  82. package/lib/module/theming/MaterialTheme.js +4 -0
  83. package/lib/module/theming/MaterialTheme.js.map +1 -0
  84. package/lib/module/useBackButton.js.map +1 -1
  85. package/lib/module/useDocumentTitle.js.map +1 -1
  86. package/lib/module/useLinkBuilder.js +8 -7
  87. package/lib/module/useLinkBuilder.js.map +1 -1
  88. package/lib/module/useLinkProps.js +5 -26
  89. package/lib/module/useLinkProps.js.map +1 -1
  90. package/lib/module/useLinkTo.js +1 -1
  91. package/lib/module/useLinkTo.js.map +1 -1
  92. package/lib/module/useLinking.js +81 -11
  93. package/lib/module/useLinking.js.map +1 -1
  94. package/lib/module/useLinking.native.js +25 -8
  95. package/lib/module/useLinking.native.js.map +1 -1
  96. package/lib/module/useLocale.js +1 -1
  97. package/lib/module/useLocale.js.map +1 -1
  98. package/lib/module/useMemoArray.js +25 -0
  99. package/lib/module/useMemoArray.js.map +1 -0
  100. package/lib/module/useRoutePath.js +1 -1
  101. package/lib/module/useRoutePath.js.map +1 -1
  102. package/lib/module/useScrollToTop.js +3 -2
  103. package/lib/module/useScrollToTop.js.map +1 -1
  104. package/lib/typescript/src/Link.d.ts +1 -1
  105. package/lib/typescript/src/Link.d.ts.map +1 -1
  106. package/lib/typescript/src/LinkingContext.d.ts +1 -1
  107. package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
  108. package/lib/typescript/src/LocaleDirContext.d.ts +1 -1
  109. package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -1
  110. package/lib/typescript/src/NavigationContainer.d.ts +13 -6
  111. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  112. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +6 -9
  113. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -1
  114. package/lib/typescript/src/__stubs__/window.d.ts.map +1 -1
  115. package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
  116. package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -1
  117. package/lib/typescript/src/createStandardNavigationFactories.d.ts +31 -0
  118. package/lib/typescript/src/createStandardNavigationFactories.d.ts.map +1 -0
  119. package/lib/typescript/src/createStaticNavigation.d.ts +7 -7
  120. package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
  121. package/lib/typescript/src/extractPathFromURL.d.ts +1 -1
  122. package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
  123. package/lib/typescript/src/getStateFromHref.d.ts +3 -3
  124. package/lib/typescript/src/getStateFromHref.d.ts.map +1 -1
  125. package/lib/typescript/src/index.d.ts +17 -15
  126. package/lib/typescript/src/index.d.ts.map +1 -1
  127. package/lib/typescript/src/native/CornerInset.d.ts +28 -0
  128. package/lib/typescript/src/native/CornerInset.d.ts.map +1 -0
  129. package/lib/typescript/src/native/CornerInset.ios.d.ts +8 -0
  130. package/lib/typescript/src/native/CornerInset.ios.d.ts.map +1 -0
  131. package/lib/typescript/src/native/MaterialSymbol.android.d.ts +3 -3
  132. package/lib/typescript/src/native/MaterialSymbol.android.d.ts.map +1 -1
  133. package/lib/typescript/src/native/MaterialSymbol.d.ts +1 -1
  134. package/lib/typescript/src/native/MaterialSymbol.d.ts.map +1 -1
  135. package/lib/typescript/src/native/MaterialSymbolData.d.ts +0 -3
  136. package/lib/typescript/src/native/MaterialSymbolData.d.ts.map +1 -1
  137. package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts +3 -3
  138. package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts.map +1 -1
  139. package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts +1 -1
  140. package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts.map +1 -1
  141. package/lib/typescript/src/native/ReactNavigationCornerInsetViewNativeComponent.d.ts +14 -0
  142. package/lib/typescript/src/native/ReactNavigationCornerInsetViewNativeComponent.d.ts.map +1 -0
  143. package/lib/typescript/src/native/SFSymbol.d.ts +1 -1
  144. package/lib/typescript/src/native/SFSymbol.d.ts.map +1 -1
  145. package/lib/typescript/src/native/SFSymbol.ios.d.ts +2 -2
  146. package/lib/typescript/src/native/SFSymbol.ios.d.ts.map +1 -1
  147. package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts +28 -1
  148. package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts.map +1 -1
  149. package/lib/typescript/src/native/constants.d.ts +12 -0
  150. package/lib/typescript/src/native/constants.d.ts.map +1 -0
  151. package/lib/typescript/src/native/types.d.ts +345 -5
  152. package/lib/typescript/src/native/types.d.ts.map +1 -1
  153. package/lib/typescript/src/{ServerContext.d.ts → server/ServerContext.d.ts} +1 -4
  154. package/lib/typescript/src/server/ServerContext.d.ts.map +1 -0
  155. package/lib/typescript/src/server/index.d.ts +10 -0
  156. package/lib/typescript/src/server/index.d.ts.map +1 -0
  157. package/lib/typescript/src/theming/DarkTheme.d.ts +4 -4
  158. package/lib/typescript/src/theming/{DefaultTheme.d.ts → LightTheme.d.ts} +5 -5
  159. package/lib/typescript/src/theming/LightTheme.d.ts.map +1 -0
  160. package/lib/typescript/src/theming/MaterialFallbackTheme.d.ts +127 -0
  161. package/lib/typescript/src/theming/MaterialFallbackTheme.d.ts.map +1 -0
  162. package/lib/typescript/src/theming/MaterialTheme.android.d.ts +251 -0
  163. package/lib/typescript/src/theming/MaterialTheme.android.d.ts.map +1 -0
  164. package/lib/typescript/src/theming/MaterialTheme.d.ts +2 -0
  165. package/lib/typescript/src/theming/MaterialTheme.d.ts.map +1 -0
  166. package/lib/typescript/src/types.d.ts +13 -16
  167. package/lib/typescript/src/types.d.ts.map +1 -1
  168. package/lib/typescript/src/useBackButton.d.ts +1 -1
  169. package/lib/typescript/src/useBackButton.d.ts.map +1 -1
  170. package/lib/typescript/src/useDocumentTitle.d.ts +2 -2
  171. package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
  172. package/lib/typescript/src/useLinkBuilder.d.ts +54 -66
  173. package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
  174. package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
  175. package/lib/typescript/src/useLinking.d.ts +17 -19
  176. package/lib/typescript/src/useLinking.d.ts.map +1 -1
  177. package/lib/typescript/src/useLinking.native.d.ts +31 -33
  178. package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
  179. package/lib/typescript/src/useLocale.d.ts +1 -1
  180. package/lib/typescript/src/useMemoArray.d.ts +2 -0
  181. package/lib/typescript/src/useMemoArray.d.ts.map +1 -0
  182. package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
  183. package/package.json +41 -22
  184. package/src/NavigationContainer.tsx +41 -32
  185. package/src/__stubs__/createStackNavigator.tsx +19 -17
  186. package/src/__stubs__/window.tsx +5 -0
  187. package/src/createMemoryHistory.tsx +19 -6
  188. package/src/createStandardNavigationFactories.tsx +218 -0
  189. package/src/createStaticNavigation.tsx +13 -17
  190. package/src/extractPathFromURL.tsx +5 -3
  191. package/src/getStateFromHref.tsx +8 -3
  192. package/src/index.tsx +11 -2
  193. package/src/native/CornerInset.ios.tsx +85 -0
  194. package/src/native/CornerInset.tsx +40 -0
  195. package/src/native/MaterialSymbol.android.tsx +9 -28
  196. package/src/native/MaterialSymbolData.tsx +0 -4
  197. package/src/native/MaterialSymbolViewNativeComponent.ts +4 -4
  198. package/src/native/NativeMaterialSymbolModule.ts +3 -4
  199. package/src/native/ReactNavigationCornerInsetViewNativeComponent.ts +32 -0
  200. package/src/native/SFSymbol.ios.tsx +84 -2
  201. package/src/native/SFSymbolViewNativeComponent.ts +28 -1
  202. package/src/native/constants.tsx +11 -0
  203. package/src/native/types.tsx +433 -4
  204. package/src/{ServerContext.tsx → server/ServerContext.tsx} +1 -4
  205. package/src/server/index.tsx +19 -0
  206. package/src/theming/DarkTheme.tsx +4 -4
  207. package/src/theming/{DefaultTheme.tsx → LightTheme.tsx} +4 -4
  208. package/src/theming/MaterialFallbackTheme.tsx +29 -0
  209. package/src/theming/MaterialTheme.android.tsx +45 -0
  210. package/src/theming/MaterialTheme.tsx +4 -0
  211. package/src/types.tsx +38 -40
  212. package/src/useBackButton.tsx +2 -2
  213. package/src/useDocumentTitle.tsx +2 -2
  214. package/src/useLinkBuilder.tsx +15 -7
  215. package/src/useLinkProps.tsx +8 -41
  216. package/src/useLinkTo.tsx +1 -1
  217. package/src/useLinking.native.tsx +58 -30
  218. package/src/useLinking.tsx +132 -22
  219. package/src/useLocale.tsx +1 -1
  220. package/src/useMemoArray.tsx +41 -0
  221. package/src/useRoutePath.tsx +1 -1
  222. package/src/useScrollToTop.tsx +3 -2
  223. package/android/build/.transforms/586a73aab4c351d3f13dc604ca6964e8/results.bin +0 -1
  224. package/android/build/.transforms/586a73aab4c351d3f13dc604ca6964e8/transformed/classes/classes_dex/classes.dex +0 -0
  225. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/results.bin +0 -1
  226. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.dex +0 -0
  227. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.dex +0 -0
  228. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.dex +0 -0
  229. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.dex +0 -0
  230. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.dex +0 -0
  231. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/BuildConfig.dex +0 -0
  232. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$Companion.dex +0 -0
  233. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$WhenMappings.dex +0 -0
  234. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$getImageSource$1.dex +0 -0
  235. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule.dex +0 -0
  236. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolTypeface.dex +0 -0
  237. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolView.dex +0 -0
  238. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolViewManager$Companion.dex +0 -0
  239. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolViewManager.dex +0 -0
  240. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/ReactNavigationPackage.dex +0 -0
  241. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  242. package/android/build/generated/source/buildConfig/debug/org/reactnavigation/BuildConfig.java +0 -10
  243. package/android/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.java +0 -38
  244. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.java +0 -45
  245. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.java +0 -22
  246. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.java +0 -39
  247. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.java +0 -20
  248. package/android/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  249. package/android/build/generated/source/codegen/jni/ReactNavigationSpec-generated.cpp +0 -32
  250. package/android/build/generated/source/codegen/jni/ReactNavigationSpec.h +0 -31
  251. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ComponentDescriptors.cpp +0 -23
  252. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ComponentDescriptors.h +0 -25
  253. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/EventEmitters.cpp +0 -17
  254. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/EventEmitters.h +0 -30
  255. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/Props.cpp +0 -106
  256. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/Props.h +0 -113
  257. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ReactNavigationSpecJSI-generated.cpp +0 -32
  258. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ReactNavigationSpecJSI.h +0 -71
  259. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ShadowNodes.cpp +0 -18
  260. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ShadowNodes.h +0 -43
  261. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/States.cpp +0 -16
  262. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/States.h +0 -22
  263. package/android/build/generated/source/codegen/schema.json +0 -1
  264. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -7
  265. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +0 -18
  266. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +0 -6
  267. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +0 -1
  268. package/android/build/intermediates/assets/debug/mergeDebugAssets/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
  269. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  270. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  271. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  272. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  273. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  274. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +0 -2
  275. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  276. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  277. package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/react-navigation_native_debug.kotlin_module +0 -0
  278. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.class +0 -0
  279. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.class +0 -0
  280. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.class +0 -0
  281. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.class +0 -0
  282. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.class +0 -0
  283. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/org/reactnavigation/BuildConfig.class +0 -0
  284. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +0 -2
  285. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +0 -7
  286. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +0 -7
  287. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +0 -1
  288. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +0 -1
  289. package/android/build/intermediates/react-navigation/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
  290. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/react-navigation_native_debug.kotlin_module +0 -0
  291. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.class +0 -0
  292. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.class +0 -0
  293. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.class +0 -0
  294. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerDelegate.class +0 -0
  295. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationSFSymbolViewManagerInterface.class +0 -0
  296. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/BuildConfig.class +0 -0
  297. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$Companion.class +0 -0
  298. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$WhenMappings.class +0 -0
  299. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$getImageSource$1.class +0 -0
  300. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule.class +0 -0
  301. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolTypeface.class +0 -0
  302. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolView.class +0 -0
  303. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolViewManager$Companion.class +0 -0
  304. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolViewManager.class +0 -0
  305. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/ReactNavigationPackage.class +0 -0
  306. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  307. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +0 -1
  308. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  309. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  310. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  311. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  312. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  313. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  314. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  315. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  316. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  317. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  318. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  319. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  320. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  321. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  322. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  323. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  324. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  325. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  326. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  327. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  328. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  329. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  330. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  331. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  332. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  333. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  334. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  335. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  336. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  337. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  338. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  339. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  340. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  341. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  342. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  343. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  344. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  345. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  346. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  347. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  348. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  349. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  350. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  351. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  352. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  353. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  354. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  355. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  356. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  357. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  358. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  359. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  360. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  361. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  362. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  363. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  364. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  365. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  366. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  367. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  368. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  369. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  370. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  371. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  372. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  373. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  374. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  375. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  376. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  377. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  378. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  379. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  380. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  381. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  382. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  383. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  384. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  385. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  386. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  387. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  388. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  389. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  390. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  391. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  392. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  393. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  394. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  395. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -16
  396. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  397. package/android/build/tmp/kotlin-classes/debug/META-INF/react-navigation_native_debug.kotlin_module +0 -0
  398. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$Companion.class +0 -0
  399. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$WhenMappings.class +0 -0
  400. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$getImageSource$1.class +0 -0
  401. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule.class +0 -0
  402. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolTypeface.class +0 -0
  403. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolView.class +0 -0
  404. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolViewManager$Companion.class +0 -0
  405. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolViewManager.class +0 -0
  406. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/ReactNavigationPackage.class +0 -0
  407. package/lib/module/ServerContainer.js +0 -55
  408. package/lib/module/ServerContainer.js.map +0 -1
  409. package/lib/module/ServerContext.js.map +0 -1
  410. package/lib/module/theming/DefaultTheme.js.map +0 -1
  411. package/lib/typescript/src/ServerContainer.d.ts +0 -14
  412. package/lib/typescript/src/ServerContainer.d.ts.map +0 -1
  413. package/lib/typescript/src/ServerContext.d.ts.map +0 -1
  414. package/lib/typescript/src/theming/DefaultTheme.d.ts.map +0 -1
  415. package/src/ServerContainer.tsx +0 -57
  416. /package/lib/module/{ServerContext.js → server/ServerContext.js} +0 -0
@@ -12,21 +12,26 @@ import isEqual from 'fast-deep-equal';
12
12
  import * as React from 'react';
13
13
 
14
14
  import { createMemoryHistory } from './createMemoryHistory';
15
- import { ServerContext } from './ServerContext';
15
+ import { ServerContext } from './server/ServerContext';
16
16
  import type { LinkingOptions } from './types';
17
17
  import type { Thenable } from './useThenable';
18
18
 
19
19
  type ResultState = ReturnType<typeof getStateFromPathDefault>;
20
20
 
21
+ const getRoutesUntilIndex = (state: NavigationState) =>
22
+ state.routes.slice(0, state.index + 1);
23
+
21
24
  /**
22
25
  * Calculate total history length including both navigator history and route history
23
26
  */
24
27
  const getTotalHistoryLength = (state: NavigationState): number => {
28
+ const routes = getRoutesUntilIndex(state);
29
+
25
30
  const baseHistoryLength = state.history
26
31
  ? state.history.length
27
- : state.routes.length;
32
+ : routes.length;
28
33
 
29
- const routeHistoryLength = state.routes.reduce((acc, r) => {
34
+ const routeHistoryLength = routes.reduce((acc, r) => {
30
35
  return acc + (r.history ? r.history.length : 0);
31
36
  }, 0);
32
37
 
@@ -51,6 +56,10 @@ const findMatchingState = <T extends NavigationState>(
51
56
  const aRoute = a.routes[a.index];
52
57
  const bRoute = b.routes[b.index];
53
58
 
59
+ if (aRoute == null || bRoute == null) {
60
+ return [a, b];
61
+ }
62
+
54
63
  const aChildState = aRoute.state as T | undefined;
55
64
  const bChildState = bRoute.state as T | undefined;
56
65
 
@@ -74,6 +83,48 @@ const findMatchingState = <T extends NavigationState>(
74
83
  return findMatchingState(aChildState, bChildState);
75
84
  };
76
85
 
86
+ /**
87
+ * Check if the state change is popping the last route or history entry.
88
+ */
89
+ const isPoppingLastEntry = (
90
+ current: NavigationState,
91
+ record: NavigationState
92
+ ): boolean => {
93
+ const currentRoute = current.routes[current.index];
94
+ const recordRoute = record.routes[record.index];
95
+
96
+ if (currentRoute == null || recordRoute == null) {
97
+ return false;
98
+ }
99
+
100
+ const currentRouteHistory = currentRoute.history;
101
+ const recordRouteHistory = recordRoute.history ?? [];
102
+
103
+ if (currentRouteHistory?.length) {
104
+ return (
105
+ currentRoute.key === recordRoute.key &&
106
+ currentRouteHistory.length === recordRouteHistory.length + 1
107
+ );
108
+ }
109
+
110
+ if (current.history && record.history) {
111
+ return current.history.length === record.history.length + 1;
112
+ }
113
+
114
+ const currentRoutes = getRoutesUntilIndex(current);
115
+ const recordRoutes = getRoutesUntilIndex(record);
116
+
117
+ if (currentRoutes.length === recordRoutes.length + 1) {
118
+ return recordRoutes.every((route, i) => {
119
+ const currentRoute = currentRoutes[i];
120
+
121
+ return currentRoute != null && route.key === currentRoute.key;
122
+ });
123
+ }
124
+
125
+ return false;
126
+ };
127
+
77
128
  /**
78
129
  * Run async function in series as it's called.
79
130
  */
@@ -88,17 +139,15 @@ export const series = (cb: () => Promise<void>) => {
88
139
 
89
140
  const linkingHandlers = new Set<symbol>();
90
141
 
91
- type Options = LinkingOptions<ParamListBase>;
92
-
93
- export function useLinking(
94
- ref: React.RefObject<NavigationContainerRef<ParamListBase> | null>,
142
+ export function useLinking<ParamList extends ParamListBase>(
143
+ ref: React.RefObject<NavigationContainerRef<ParamList> | null>,
95
144
  {
96
145
  enabled = true,
97
146
  config,
98
147
  getStateFromPath = getStateFromPathDefault,
99
148
  getPathFromState = getPathFromStateDefault,
100
149
  getActionFromState = getActionFromStateDefault,
101
- }: Options
150
+ }: LinkingOptions<ParamList>
102
151
  ) {
103
152
  const independent = useNavigationIndependentTree();
104
153
 
@@ -134,7 +183,15 @@ export function useLinking(
134
183
  };
135
184
  }, [enabled, independent]);
136
185
 
137
- const [history] = React.useState(createMemoryHistory);
186
+ const server = React.use(ServerContext);
187
+
188
+ const [history] = React.useState(() => {
189
+ if (server || typeof window === 'undefined') {
190
+ return undefined;
191
+ }
192
+
193
+ return createMemoryHistory();
194
+ });
138
195
 
139
196
  // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners
140
197
  // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`
@@ -164,20 +221,26 @@ export function useLinking(
164
221
  [ref]
165
222
  );
166
223
 
167
- const server = React.useContext(ServerContext);
168
-
169
224
  const getInitialState = React.useCallback(() => {
170
225
  let value: ResultState | undefined;
171
226
 
172
227
  if (enabledRef.current) {
173
- const location =
174
- server?.location ??
175
- (typeof window !== 'undefined' ? window.location : undefined);
228
+ const location = server
229
+ ? server.location
230
+ : typeof window !== 'undefined'
231
+ ? window.location
232
+ : undefined;
176
233
 
177
234
  const path = location ? location.pathname + location.search : undefined;
178
235
 
179
236
  if (path) {
180
- value = getStateFromPathRef.current(path, configRef.current);
237
+ try {
238
+ value = getStateFromPathRef.current(path, configRef.current);
239
+ } catch (e) {
240
+ console.error(e);
241
+
242
+ value = undefined;
243
+ }
181
244
  }
182
245
  }
183
246
 
@@ -196,6 +259,10 @@ export function useLinking(
196
259
  const pendingPopStatePathRef = React.useRef<string | undefined>(undefined);
197
260
 
198
261
  React.useEffect(() => {
262
+ if (!history) {
263
+ return;
264
+ }
265
+
199
266
  previousIndexRef.current = history.index;
200
267
 
201
268
  return history.listen(() => {
@@ -221,11 +288,43 @@ export function useLinking(
221
288
  const record = history.get(index);
222
289
 
223
290
  if (record?.path === path && record?.state) {
224
- navigation.resetRoot(record.state);
291
+ const currentState = navigation.getRootState();
292
+
293
+ const [currentFocused, recordFocused] = findMatchingState(
294
+ currentState,
295
+ record.state
296
+ );
297
+
298
+ if (
299
+ previousIndex - index === 1 &&
300
+ currentFocused &&
301
+ recordFocused &&
302
+ isPoppingLastEntry(currentFocused, recordFocused)
303
+ ) {
304
+ // If we detect that the state change is popping the last entry
305
+ // Dispatch a back action instead of resetting to the state
306
+ // This makes sure changes to history state since the entry was added don't get lost
307
+ navigation.goBack();
308
+ } else {
309
+ navigation.resetRoot(record.state);
310
+ }
311
+
225
312
  return;
226
313
  }
227
314
 
228
- const state = getStateFromPathRef.current(path, configRef.current);
315
+ let state: ResultState | undefined;
316
+
317
+ try {
318
+ state = getStateFromPathRef.current(
319
+ path,
320
+ configRef.current,
321
+ navigation.getRootState()
322
+ );
323
+ } catch (e) {
324
+ console.error(e);
325
+
326
+ state = undefined;
327
+ }
229
328
 
230
329
  // We should only dispatch an action when going forward
231
330
  // Otherwise the action will likely add items to history, which would mess things up
@@ -270,7 +369,7 @@ export function useLinking(
270
369
  }, [enabled, history, ref, validateRoutesNotExistInRootState]);
271
370
 
272
371
  React.useEffect(() => {
273
- if (!enabled) {
372
+ if (!enabled || !history) {
274
373
  return;
275
374
  }
276
375
 
@@ -283,10 +382,18 @@ export function useLinking(
283
382
  // If the `route` object contains a `path`, use that path as long as `route.name` and `params` still match
284
383
  // This makes sure that we preserve the original URL for wildcard routes
285
384
  if (route?.path) {
286
- const stateForPath = getStateFromPathRef.current(
287
- route.path,
288
- configRef.current
289
- );
385
+ let stateForPath: ResultState | undefined;
386
+
387
+ try {
388
+ stateForPath = getStateFromPathRef.current(
389
+ route.path,
390
+ configRef.current
391
+ );
392
+ } catch (e) {
393
+ console.error(e);
394
+
395
+ stateForPath = undefined;
396
+ }
290
397
 
291
398
  if (stateForPath) {
292
399
  const focusedRoute = findFocusedRoute(stateForPath);
@@ -337,6 +444,7 @@ export function useLinking(
337
444
  }
338
445
 
339
446
  history.replace({ path, state });
447
+ previousIndexRef.current = history.index;
340
448
  }
341
449
  }
342
450
 
@@ -422,6 +530,8 @@ export function useLinking(
422
530
  // This would happen if the user did a reset/conditionally changed navigators
423
531
  history.replace({ path, state });
424
532
  }
533
+
534
+ previousIndexRef.current = history.index;
425
535
  };
426
536
 
427
537
  // We debounce onStateChange coz we don't want multiple state changes to be handled at one time
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.useContext(LocaleDirContext);
9
+ const direction = React.use(LocaleDirContext);
10
10
 
11
11
  if (direction === undefined) {
12
12
  throw new Error(
@@ -0,0 +1,41 @@
1
+ import * as React from 'react';
2
+
3
+ export function useMemoArray<T>(
4
+ entries: [item: T, deps: readonly unknown[]][]
5
+ ): T[] {
6
+ const previousRef = React.useRef<
7
+ | {
8
+ entries: { item: T; deps: readonly unknown[] }[];
9
+ items: T[];
10
+ }
11
+ | undefined
12
+ >(undefined);
13
+
14
+ const previous = previousRef.current;
15
+ const next = entries.map(([item, deps], index) => {
16
+ const previousEntry = previous?.entries[index];
17
+ const depsEqual =
18
+ previousEntry &&
19
+ previousEntry.deps.length === deps.length &&
20
+ previousEntry.deps.every((it, index) => Object.is(it, deps[index]));
21
+
22
+ return depsEqual ? previousEntry : { item, deps };
23
+ });
24
+
25
+ if (
26
+ previous &&
27
+ previous.entries.length === next.length &&
28
+ next.every((entry, index) => entry === previous.entries[index])
29
+ ) {
30
+ return previous.items;
31
+ }
32
+
33
+ const items = next.map((entry) => entry.item);
34
+
35
+ previousRef.current = {
36
+ entries: next,
37
+ items,
38
+ };
39
+
40
+ return items;
41
+ }
@@ -9,7 +9,7 @@ import { LinkingContext } from './LinkingContext';
9
9
  * @returns Path for the current route.
10
10
  */
11
11
  export function useRoutePath() {
12
- const { options } = React.useContext(LinkingContext);
12
+ const { options } = React.use(LinkingContext);
13
13
  const state = useStateForPath();
14
14
 
15
15
  if (state === undefined) {
@@ -51,7 +51,7 @@ function getScrollableNode(ref: React.RefObject<ScrollableWrapper>) {
51
51
  }
52
52
 
53
53
  export function useScrollToTop(ref: React.RefObject<ScrollableWrapper>) {
54
- const navigation = React.useContext(NavigationContext);
54
+ const navigation = React.use(NavigationContext);
55
55
  const route = useRoute();
56
56
 
57
57
  if (navigation === undefined) {
@@ -91,9 +91,10 @@ export function useScrollToTop(ref: React.RefObject<ScrollableWrapper>) {
91
91
 
92
92
  // In a nested stack navigator, tab press resets the stack to first screen
93
93
  // So we should scroll to top only when we are on first screen
94
+ const firstRoute = navigation.getState().routes[0];
94
95
  const isFirst =
95
96
  tabNavigations.includes(navigation) ||
96
- navigation.getState().routes[0].key === route.key;
97
+ firstRoute?.key === route.key;
97
98
 
98
99
  // Run the operation in the next frame so we're sure all listeners have been run
99
100
  // This is necessary to know if preventDefault() has been called
@@ -1 +0,0 @@
1
- o/bundleLibRuntimeToDirDebug
@@ -1,10 +0,0 @@
1
- /**
2
- * Automatically generated file. DO NOT MODIFY
3
- */
4
- package org.reactnavigation;
5
-
6
- public final class BuildConfig {
7
- public static final boolean DEBUG = Boolean.parseBoolean("true");
8
- public static final String LIBRARY_PACKAGE_NAME = "org.reactnavigation";
9
- public static final String BUILD_TYPE = "debug";
10
- }
@@ -1,38 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.facebook.fbreact.specs;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.ReactApplicationContext;
17
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
- import com.facebook.react.bridge.ReactMethod;
19
- import com.facebook.react.bridge.ReadableMap;
20
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
21
- import javax.annotation.Nonnull;
22
-
23
- public abstract class NativeMaterialSymbolModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
24
- public static final String NAME = "ReactNavigationMaterialSymbolModule";
25
-
26
- public NativeMaterialSymbolModuleSpec(ReactApplicationContext reactContext) {
27
- super(reactContext);
28
- }
29
-
30
- @Override
31
- public @Nonnull String getName() {
32
- return NAME;
33
- }
34
-
35
- @ReactMethod(isBlockingSynchronousMethod = true)
36
- @DoNotStrip
37
- public abstract String getImageSource(String name, String variant, double size, double weight, ReadableMap color, String hash);
38
- }
@@ -1,45 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaDelegate.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
- import androidx.annotation.Nullable;
14
- import com.facebook.react.bridge.ColorPropConverter;
15
- import com.facebook.react.uimanager.BaseViewManager;
16
- import com.facebook.react.uimanager.BaseViewManagerDelegate;
17
- import com.facebook.react.uimanager.LayoutShadowNode;
18
-
19
- public class ReactNavigationMaterialSymbolViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ReactNavigationMaterialSymbolViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
20
- public ReactNavigationMaterialSymbolViewManagerDelegate(U viewManager) {
21
- super(viewManager);
22
- }
23
- @Override
24
- public void setProperty(T view, String propName, @Nullable Object value) {
25
- switch (propName) {
26
- case "name":
27
- mViewManager.setName(view, value == null ? null : (String) value);
28
- break;
29
- case "variant":
30
- mViewManager.setVariant(view, value == null ? null : (String) value);
31
- break;
32
- case "weight":
33
- mViewManager.setWeight(view, value == null ? 400 : ((Double) value).intValue());
34
- break;
35
- case "size":
36
- mViewManager.setSize(view, value == null ? Float.NaN : ((Double) value).floatValue());
37
- break;
38
- case "color":
39
- mViewManager.setColor(view, ColorPropConverter.getColor(value, view.getContext()));
40
- break;
41
- default:
42
- super.setProperty(view, propName, value);
43
- }
44
- }
45
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaInterface.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
- import androidx.annotation.Nullable;
14
- import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
15
-
16
- public interface ReactNavigationMaterialSymbolViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
17
- void setName(T view, @Nullable String value);
18
- void setVariant(T view, @Nullable String value);
19
- void setWeight(T view, @Nullable Integer value);
20
- void setSize(T view, float value);
21
- void setColor(T view, @Nullable Integer value);
22
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaDelegate.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
- import androidx.annotation.Nullable;
14
- import com.facebook.react.bridge.ColorPropConverter;
15
- import com.facebook.react.uimanager.BaseViewManager;
16
- import com.facebook.react.uimanager.BaseViewManagerDelegate;
17
- import com.facebook.react.uimanager.LayoutShadowNode;
18
-
19
- public class ReactNavigationSFSymbolViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & ReactNavigationSFSymbolViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
20
- public ReactNavigationSFSymbolViewManagerDelegate(U viewManager) {
21
- super(viewManager);
22
- }
23
- @Override
24
- public void setProperty(T view, String propName, @Nullable Object value) {
25
- switch (propName) {
26
- case "name":
27
- mViewManager.setName(view, value == null ? null : (String) value);
28
- break;
29
- case "size":
30
- mViewManager.setSize(view, value == null ? Float.NaN : ((Double) value).floatValue());
31
- break;
32
- case "color":
33
- mViewManager.setColor(view, ColorPropConverter.getColor(value, view.getContext()));
34
- break;
35
- default:
36
- super.setProperty(view, propName, value);
37
- }
38
- }
39
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaInterface.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
- import androidx.annotation.Nullable;
14
- import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
15
-
16
- public interface ReactNavigationSFSymbolViewManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
17
- void setName(T view, @Nullable String value);
18
- void setSize(T view, float value);
19
- void setColor(T view, @Nullable Integer value);
20
- }
@@ -1,28 +0,0 @@
1
- # Copyright (c) Meta Platforms, Inc. and affiliates.
2
- #
3
- # This source code is licensed under the MIT license found in the
4
- # LICENSE file in the root directory of this source tree.
5
-
6
- cmake_minimum_required(VERSION 3.13)
7
- set(CMAKE_VERBOSE_MAKEFILE on)
8
-
9
- file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/ReactNavigationSpec/*.cpp)
10
-
11
- add_library(
12
- react_codegen_ReactNavigationSpec
13
- OBJECT
14
- ${react_codegen_SRCS}
15
- )
16
-
17
- target_include_directories(react_codegen_ReactNavigationSpec PUBLIC . react/renderer/components/ReactNavigationSpec)
18
-
19
- target_link_libraries(
20
- react_codegen_ReactNavigationSpec
21
- fbjni
22
- jsi
23
- # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
- # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
- reactnative
26
- )
27
-
28
- target_compile_reactnative_options(react_codegen_ReactNavigationSpec PRIVATE)
@@ -1,32 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJniCpp.js
9
- */
10
-
11
- #include "ReactNavigationSpec.h"
12
-
13
- namespace facebook::react {
14
-
15
- static facebook::jsi::Value __hostFunction_NativeMaterialSymbolModuleSpecJSI_getImageSource(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
- static jmethodID cachedMethodId = nullptr;
17
- return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, StringKind, "getImageSource", "(Ljava/lang/String;Ljava/lang/String;DDLcom/facebook/react/bridge/ReadableMap;Ljava/lang/String;)Ljava/lang/String;", args, count, cachedMethodId);
18
- }
19
-
20
- NativeMaterialSymbolModuleSpecJSI::NativeMaterialSymbolModuleSpecJSI(const JavaTurboModule::InitParams &params)
21
- : JavaTurboModule(params) {
22
- methodMap_["getImageSource"] = MethodMetadata {6, __hostFunction_NativeMaterialSymbolModuleSpecJSI_getImageSource};
23
- }
24
-
25
- std::shared_ptr<TurboModule> ReactNavigationSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
26
- if (moduleName == "ReactNavigationMaterialSymbolModule") {
27
- return std::make_shared<NativeMaterialSymbolModuleSpecJSI>(params);
28
- }
29
- return nullptr;
30
- }
31
-
32
- } // namespace facebook::react