@react-navigation/core 6.4.8 → 7.0.0-alpha.1

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 (446) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/BaseNavigationContainer.js +71 -61
  3. package/lib/commonjs/BaseNavigationContainer.js.map +1 -1
  4. package/lib/commonjs/CurrentRenderContext.js +2 -3
  5. package/lib/commonjs/CurrentRenderContext.js.map +1 -1
  6. package/lib/commonjs/DeprecatedNavigationInChildContext.js +15 -0
  7. package/lib/commonjs/DeprecatedNavigationInChildContext.js.map +1 -0
  8. package/lib/commonjs/EnsureSingleNavigator.js +1 -1
  9. package/lib/commonjs/EnsureSingleNavigator.js.map +1 -1
  10. package/lib/commonjs/Group.js +1 -1
  11. package/lib/commonjs/Group.js.map +1 -1
  12. package/lib/commonjs/NavigationBuilderContext.js +2 -3
  13. package/lib/commonjs/NavigationBuilderContext.js.map +1 -1
  14. package/lib/commonjs/NavigationContainerRefContext.js +2 -3
  15. package/lib/commonjs/NavigationContainerRefContext.js.map +1 -1
  16. package/lib/commonjs/NavigationContext.js +2 -3
  17. package/lib/commonjs/NavigationContext.js.map +1 -1
  18. package/lib/commonjs/NavigationHelpersContext.js +2 -3
  19. package/lib/commonjs/NavigationHelpersContext.js.map +1 -1
  20. package/lib/commonjs/NavigationIndependentTree.js +32 -0
  21. package/lib/commonjs/NavigationIndependentTree.js.map +1 -0
  22. package/lib/commonjs/NavigationIndependentTreeContext.js +15 -0
  23. package/lib/commonjs/NavigationIndependentTreeContext.js.map +1 -0
  24. package/lib/commonjs/NavigationRouteContext.js +2 -3
  25. package/lib/commonjs/NavigationRouteContext.js.map +1 -1
  26. package/lib/commonjs/NavigationStateContext.js +3 -3
  27. package/lib/commonjs/NavigationStateContext.js.map +1 -1
  28. package/lib/commonjs/PreventRemoveContext.js +2 -3
  29. package/lib/commonjs/PreventRemoveContext.js.map +1 -1
  30. package/lib/commonjs/PreventRemoveProvider.js +8 -8
  31. package/lib/commonjs/PreventRemoveProvider.js.map +1 -1
  32. package/lib/commonjs/SceneView.js +8 -9
  33. package/lib/commonjs/SceneView.js.map +1 -1
  34. package/lib/commonjs/Screen.js +1 -1
  35. package/lib/commonjs/Screen.js.map +1 -1
  36. package/lib/commonjs/StaticContainer.js +4 -5
  37. package/lib/commonjs/StaticContainer.js.map +1 -1
  38. package/lib/commonjs/StaticNavigation.js +159 -0
  39. package/lib/commonjs/StaticNavigation.js.map +1 -0
  40. package/lib/commonjs/UnhandledActionContext.js +2 -3
  41. package/lib/commonjs/UnhandledActionContext.js.map +1 -1
  42. package/lib/commonjs/checkDuplicateRouteNames.js +1 -1
  43. package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -1
  44. package/lib/commonjs/checkSerializable.js +1 -1
  45. package/lib/commonjs/checkSerializable.js.map +1 -1
  46. package/lib/commonjs/createNavigationContainerRef.js +1 -1
  47. package/lib/commonjs/createNavigationContainerRef.js.map +1 -1
  48. package/lib/commonjs/createNavigatorFactory.js +19 -11
  49. package/lib/commonjs/createNavigatorFactory.js.map +1 -1
  50. package/lib/commonjs/findFocusedRoute.js +1 -1
  51. package/lib/commonjs/findFocusedRoute.js.map +1 -1
  52. package/lib/commonjs/fromEntries.js +1 -1
  53. package/lib/commonjs/fromEntries.js.map +1 -1
  54. package/lib/commonjs/getActionFromState.js +1 -1
  55. package/lib/commonjs/getActionFromState.js.map +1 -1
  56. package/lib/commonjs/getFocusedRouteNameFromRoute.js +1 -1
  57. package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -1
  58. package/lib/commonjs/getPathFromState.js +6 -7
  59. package/lib/commonjs/getPathFromState.js.map +1 -1
  60. package/lib/commonjs/getStateFromPath.js +5 -5
  61. package/lib/commonjs/getStateFromPath.js.map +1 -1
  62. package/lib/commonjs/index.js +83 -53
  63. package/lib/commonjs/index.js.map +1 -1
  64. package/lib/commonjs/isArrayEqual.js +1 -1
  65. package/lib/commonjs/isArrayEqual.js.map +1 -1
  66. package/lib/commonjs/isRecordEqual.js +1 -1
  67. package/lib/commonjs/isRecordEqual.js.map +1 -1
  68. package/lib/commonjs/useChildListeners.js +1 -1
  69. package/lib/commonjs/useChildListeners.js.map +1 -1
  70. package/lib/commonjs/useComponent.js +1 -1
  71. package/lib/commonjs/useComponent.js.map +1 -1
  72. package/lib/commonjs/useCurrentRender.js +3 -4
  73. package/lib/commonjs/useCurrentRender.js.map +1 -1
  74. package/lib/commonjs/useDescriptors.js +31 -29
  75. package/lib/commonjs/useDescriptors.js.map +1 -1
  76. package/lib/commonjs/useEventEmitter.js +1 -1
  77. package/lib/commonjs/useEventEmitter.js.map +1 -1
  78. package/lib/commonjs/useFocusEffect.js +3 -4
  79. package/lib/commonjs/useFocusEffect.js.map +1 -1
  80. package/lib/commonjs/useFocusEvents.js +3 -4
  81. package/lib/commonjs/useFocusEvents.js.map +1 -1
  82. package/lib/commonjs/useFocusedListenersChildrenAdapter.js +3 -4
  83. package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -1
  84. package/lib/commonjs/useIsFocused.js +3 -4
  85. package/lib/commonjs/useIsFocused.js.map +1 -1
  86. package/lib/commonjs/useKeyedChildListeners.js +1 -1
  87. package/lib/commonjs/useKeyedChildListeners.js.map +1 -1
  88. package/lib/commonjs/useNavigation.js +5 -6
  89. package/lib/commonjs/useNavigation.js.map +1 -1
  90. package/lib/commonjs/useNavigationBuilder.js +45 -46
  91. package/lib/commonjs/useNavigationBuilder.js.map +1 -1
  92. package/lib/commonjs/useNavigationCache.js +12 -11
  93. package/lib/commonjs/useNavigationCache.js.map +1 -1
  94. package/lib/commonjs/useNavigationContainerRef.js +3 -4
  95. package/lib/commonjs/useNavigationContainerRef.js.map +1 -1
  96. package/lib/commonjs/useNavigationHelpers.js +5 -6
  97. package/lib/commonjs/useNavigationHelpers.js.map +1 -1
  98. package/lib/commonjs/useNavigationIndependentTree.js +14 -0
  99. package/lib/commonjs/useNavigationIndependentTree.js.map +1 -0
  100. package/lib/commonjs/useNavigationState.js +3 -4
  101. package/lib/commonjs/useNavigationState.js.map +1 -1
  102. package/lib/commonjs/useOnAction.js +16 -13
  103. package/lib/commonjs/useOnAction.js.map +1 -1
  104. package/lib/commonjs/useOnGetState.js +7 -8
  105. package/lib/commonjs/useOnGetState.js.map +1 -1
  106. package/lib/commonjs/useOnPreventRemove.js +5 -6
  107. package/lib/commonjs/useOnPreventRemove.js.map +1 -1
  108. package/lib/commonjs/useOnRouteFocus.js +3 -4
  109. package/lib/commonjs/useOnRouteFocus.js.map +1 -1
  110. package/lib/commonjs/useOptionsGetters.js +5 -6
  111. package/lib/commonjs/useOptionsGetters.js.map +1 -1
  112. package/lib/commonjs/usePreventRemove.js +8 -8
  113. package/lib/commonjs/usePreventRemove.js.map +1 -1
  114. package/lib/commonjs/usePreventRemoveContext.js +3 -4
  115. package/lib/commonjs/usePreventRemoveContext.js.map +1 -1
  116. package/lib/commonjs/useRegisterNavigator.js +1 -1
  117. package/lib/commonjs/useRegisterNavigator.js.map +1 -1
  118. package/lib/commonjs/useRoute.js +3 -4
  119. package/lib/commonjs/useRoute.js.map +1 -1
  120. package/lib/commonjs/useRouteCache.js +1 -1
  121. package/lib/commonjs/useRouteCache.js.map +1 -1
  122. package/lib/commonjs/useScheduleUpdate.js +1 -1
  123. package/lib/commonjs/useScheduleUpdate.js.map +1 -1
  124. package/lib/commonjs/useSyncState.js +1 -1
  125. package/lib/commonjs/useSyncState.js.map +1 -1
  126. package/lib/commonjs/validatePathConfig.js +1 -1
  127. package/lib/commonjs/validatePathConfig.js.map +1 -1
  128. package/lib/module/BaseNavigationContainer.js +58 -48
  129. package/lib/module/BaseNavigationContainer.js.map +1 -1
  130. package/lib/module/CurrentRenderContext.js +1 -2
  131. package/lib/module/CurrentRenderContext.js.map +1 -1
  132. package/lib/module/DeprecatedNavigationInChildContext.js +7 -0
  133. package/lib/module/DeprecatedNavigationInChildContext.js.map +1 -0
  134. package/lib/module/EnsureSingleNavigator.js +1 -1
  135. package/lib/module/EnsureSingleNavigator.js.map +1 -1
  136. package/lib/module/Group.js +1 -1
  137. package/lib/module/Group.js.map +1 -1
  138. package/lib/module/NavigationBuilderContext.js +1 -2
  139. package/lib/module/NavigationBuilderContext.js.map +1 -1
  140. package/lib/module/NavigationContainerRefContext.js +1 -2
  141. package/lib/module/NavigationContainerRefContext.js.map +1 -1
  142. package/lib/module/NavigationContext.js +1 -2
  143. package/lib/module/NavigationContext.js.map +1 -1
  144. package/lib/module/NavigationHelpersContext.js +1 -2
  145. package/lib/module/NavigationHelpersContext.js.map +1 -1
  146. package/lib/module/NavigationIndependentTree.js +25 -0
  147. package/lib/module/NavigationIndependentTree.js.map +1 -0
  148. package/lib/module/NavigationIndependentTreeContext.js +7 -0
  149. package/lib/module/NavigationIndependentTreeContext.js.map +1 -0
  150. package/lib/module/NavigationRouteContext.js +1 -2
  151. package/lib/module/NavigationRouteContext.js.map +1 -1
  152. package/lib/module/NavigationStateContext.js +1 -1
  153. package/lib/module/NavigationStateContext.js.map +1 -1
  154. package/lib/module/PreventRemoveContext.js +1 -2
  155. package/lib/module/PreventRemoveContext.js.map +1 -1
  156. package/lib/module/PreventRemoveProvider.js +4 -4
  157. package/lib/module/PreventRemoveProvider.js.map +1 -1
  158. package/lib/module/SceneView.js +5 -5
  159. package/lib/module/SceneView.js.map +1 -1
  160. package/lib/module/Screen.js +1 -1
  161. package/lib/module/Screen.js.map +1 -1
  162. package/lib/module/StaticContainer.js +2 -3
  163. package/lib/module/StaticContainer.js.map +1 -1
  164. package/lib/module/StaticNavigation.js +156 -0
  165. package/lib/module/StaticNavigation.js.map +1 -0
  166. package/lib/module/UnhandledActionContext.js +1 -2
  167. package/lib/module/UnhandledActionContext.js.map +1 -1
  168. package/lib/module/checkDuplicateRouteNames.js +1 -1
  169. package/lib/module/checkDuplicateRouteNames.js.map +1 -1
  170. package/lib/module/checkSerializable.js +1 -1
  171. package/lib/module/checkSerializable.js.map +1 -1
  172. package/lib/module/createNavigationContainerRef.js +1 -1
  173. package/lib/module/createNavigationContainerRef.js.map +1 -1
  174. package/lib/module/createNavigatorFactory.js +19 -10
  175. package/lib/module/createNavigatorFactory.js.map +1 -1
  176. package/lib/module/findFocusedRoute.js +1 -1
  177. package/lib/module/findFocusedRoute.js.map +1 -1
  178. package/lib/module/fromEntries.js +1 -1
  179. package/lib/module/fromEntries.js.map +1 -1
  180. package/lib/module/getActionFromState.js +1 -1
  181. package/lib/module/getActionFromState.js.map +1 -1
  182. package/lib/module/getFocusedRouteNameFromRoute.js +1 -1
  183. package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -1
  184. package/lib/module/getPathFromState.js +3 -3
  185. package/lib/module/getPathFromState.js.map +1 -1
  186. package/lib/module/getStateFromPath.js +3 -3
  187. package/lib/module/getStateFromPath.js.map +1 -1
  188. package/lib/module/index.js +28 -25
  189. package/lib/module/index.js.map +1 -1
  190. package/lib/module/isArrayEqual.js +1 -1
  191. package/lib/module/isArrayEqual.js.map +1 -1
  192. package/lib/module/isRecordEqual.js +1 -1
  193. package/lib/module/isRecordEqual.js.map +1 -1
  194. package/lib/module/useChildListeners.js +1 -1
  195. package/lib/module/useChildListeners.js.map +1 -1
  196. package/lib/module/useComponent.js +1 -1
  197. package/lib/module/useComponent.js.map +1 -1
  198. package/lib/module/useCurrentRender.js +2 -2
  199. package/lib/module/useCurrentRender.js.map +1 -1
  200. package/lib/module/useDescriptors.js +28 -25
  201. package/lib/module/useDescriptors.js.map +1 -1
  202. package/lib/module/useEventEmitter.js +1 -1
  203. package/lib/module/useEventEmitter.js.map +1 -1
  204. package/lib/module/useFocusEffect.js +2 -2
  205. package/lib/module/useFocusEffect.js.map +1 -1
  206. package/lib/module/useFocusEvents.js +2 -2
  207. package/lib/module/useFocusEvents.js.map +1 -1
  208. package/lib/module/useFocusedListenersChildrenAdapter.js +2 -2
  209. package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -1
  210. package/lib/module/useIsFocused.js +2 -2
  211. package/lib/module/useIsFocused.js.map +1 -1
  212. package/lib/module/useKeyedChildListeners.js +1 -1
  213. package/lib/module/useKeyedChildListeners.js.map +1 -1
  214. package/lib/module/useNavigation.js +3 -3
  215. package/lib/module/useNavigation.js.map +1 -1
  216. package/lib/module/useNavigationBuilder.js +24 -24
  217. package/lib/module/useNavigationBuilder.js.map +1 -1
  218. package/lib/module/useNavigationCache.js +11 -9
  219. package/lib/module/useNavigationCache.js.map +1 -1
  220. package/lib/module/useNavigationContainerRef.js +2 -2
  221. package/lib/module/useNavigationContainerRef.js.map +1 -1
  222. package/lib/module/useNavigationHelpers.js +3 -3
  223. package/lib/module/useNavigationHelpers.js.map +1 -1
  224. package/lib/module/useNavigationIndependentTree.js +6 -0
  225. package/lib/module/useNavigationIndependentTree.js.map +1 -0
  226. package/lib/module/useNavigationState.js +2 -2
  227. package/lib/module/useNavigationState.js.map +1 -1
  228. package/lib/module/useOnAction.js +14 -10
  229. package/lib/module/useOnAction.js.map +1 -1
  230. package/lib/module/useOnGetState.js +4 -4
  231. package/lib/module/useOnGetState.js.map +1 -1
  232. package/lib/module/useOnPreventRemove.js +3 -3
  233. package/lib/module/useOnPreventRemove.js.map +1 -1
  234. package/lib/module/useOnRouteFocus.js +2 -2
  235. package/lib/module/useOnRouteFocus.js.map +1 -1
  236. package/lib/module/useOptionsGetters.js +3 -3
  237. package/lib/module/useOptionsGetters.js.map +1 -1
  238. package/lib/module/usePreventRemove.js +4 -4
  239. package/lib/module/usePreventRemove.js.map +1 -1
  240. package/lib/module/usePreventRemoveContext.js +2 -2
  241. package/lib/module/usePreventRemoveContext.js.map +1 -1
  242. package/lib/module/useRegisterNavigator.js +1 -1
  243. package/lib/module/useRegisterNavigator.js.map +1 -1
  244. package/lib/module/useRoute.js +2 -2
  245. package/lib/module/useRoute.js.map +1 -1
  246. package/lib/module/useRouteCache.js +1 -1
  247. package/lib/module/useRouteCache.js.map +1 -1
  248. package/lib/module/useScheduleUpdate.js +1 -1
  249. package/lib/module/useScheduleUpdate.js.map +1 -1
  250. package/lib/module/useSyncState.js +1 -1
  251. package/lib/module/useSyncState.js.map +1 -1
  252. package/lib/module/validatePathConfig.js +1 -1
  253. package/lib/module/validatePathConfig.js.map +1 -1
  254. package/lib/typescript/src/BaseNavigationContainer.d.ts +3 -2
  255. package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -1
  256. package/lib/typescript/src/CurrentRenderContext.d.ts +1 -2
  257. package/lib/typescript/src/CurrentRenderContext.d.ts.map +1 -1
  258. package/lib/typescript/src/DeprecatedNavigationInChildContext.d.ts +6 -0
  259. package/lib/typescript/src/DeprecatedNavigationInChildContext.d.ts.map +1 -0
  260. package/lib/typescript/src/EnsureSingleNavigator.d.ts +2 -2
  261. package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -1
  262. package/lib/typescript/src/Group.d.ts +1 -1
  263. package/lib/typescript/src/Group.d.ts.map +1 -1
  264. package/lib/typescript/src/NavigationBuilderContext.d.ts +10 -11
  265. package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -1
  266. package/lib/typescript/src/NavigationContainerRefContext.d.ts +1 -2
  267. package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +1 -1
  268. package/lib/typescript/src/NavigationContext.d.ts +1 -2
  269. package/lib/typescript/src/NavigationContext.d.ts.map +1 -1
  270. package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -2
  271. package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -1
  272. package/lib/typescript/src/NavigationIndependentTree.d.ts +8 -0
  273. package/lib/typescript/src/NavigationIndependentTree.d.ts.map +1 -0
  274. package/lib/typescript/src/NavigationIndependentTreeContext.d.ts +6 -0
  275. package/lib/typescript/src/NavigationIndependentTreeContext.d.ts.map +1 -0
  276. package/lib/typescript/src/NavigationRouteContext.d.ts +1 -2
  277. package/lib/typescript/src/NavigationRouteContext.d.ts.map +1 -1
  278. package/lib/typescript/src/NavigationStateContext.d.ts +1 -2
  279. package/lib/typescript/src/NavigationStateContext.d.ts.map +1 -1
  280. package/lib/typescript/src/PreventRemoveContext.d.ts +2 -3
  281. package/lib/typescript/src/PreventRemoveContext.d.ts.map +1 -1
  282. package/lib/typescript/src/PreventRemoveProvider.d.ts +2 -2
  283. package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
  284. package/lib/typescript/src/SceneView.d.ts +2 -2
  285. package/lib/typescript/src/SceneView.d.ts.map +1 -1
  286. package/lib/typescript/src/Screen.d.ts +1 -1
  287. package/lib/typescript/src/Screen.d.ts.map +1 -1
  288. package/lib/typescript/src/StaticContainer.d.ts +1 -3
  289. package/lib/typescript/src/StaticContainer.d.ts.map +1 -1
  290. package/lib/typescript/src/StaticNavigation.d.ts +159 -0
  291. package/lib/typescript/src/StaticNavigation.d.ts.map +1 -0
  292. package/lib/typescript/src/UnhandledActionContext.d.ts +1 -2
  293. package/lib/typescript/src/UnhandledActionContext.d.ts.map +1 -1
  294. package/lib/typescript/src/checkDuplicateRouteNames.d.ts +1 -1
  295. package/lib/typescript/src/checkDuplicateRouteNames.d.ts.map +1 -1
  296. package/lib/typescript/src/checkSerializable.d.ts +1 -1
  297. package/lib/typescript/src/checkSerializable.d.ts.map +1 -1
  298. package/lib/typescript/src/createNavigationContainerRef.d.ts +1 -1
  299. package/lib/typescript/src/createNavigationContainerRef.d.ts.map +1 -1
  300. package/lib/typescript/src/createNavigatorFactory.d.ts +8 -2
  301. package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -1
  302. package/lib/typescript/src/findFocusedRoute.d.ts +1 -1
  303. package/lib/typescript/src/findFocusedRoute.d.ts.map +1 -1
  304. package/lib/typescript/src/fromEntries.d.ts +1 -1
  305. package/lib/typescript/src/fromEntries.d.ts.map +1 -1
  306. package/lib/typescript/src/getActionFromState.d.ts +3 -3
  307. package/lib/typescript/src/getActionFromState.d.ts.map +1 -1
  308. package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts +1 -1
  309. package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts.map +1 -1
  310. package/lib/typescript/src/getPathFromState.d.ts +3 -3
  311. package/lib/typescript/src/getPathFromState.d.ts.map +1 -1
  312. package/lib/typescript/src/getStateFromPath.d.ts +3 -3
  313. package/lib/typescript/src/getStateFromPath.d.ts.map +1 -1
  314. package/lib/typescript/src/index.d.ts +28 -25
  315. package/lib/typescript/src/index.d.ts.map +1 -1
  316. package/lib/typescript/src/isArrayEqual.d.ts +1 -1
  317. package/lib/typescript/src/isArrayEqual.d.ts.map +1 -1
  318. package/lib/typescript/src/isRecordEqual.d.ts +1 -1
  319. package/lib/typescript/src/isRecordEqual.d.ts.map +1 -1
  320. package/lib/typescript/src/types.d.ts +109 -48
  321. package/lib/typescript/src/types.d.ts.map +1 -1
  322. package/lib/typescript/src/useChildListeners.d.ts +1 -1
  323. package/lib/typescript/src/useChildListeners.d.ts.map +1 -1
  324. package/lib/typescript/src/useComponent.d.ts +2 -2
  325. package/lib/typescript/src/useComponent.d.ts.map +1 -1
  326. package/lib/typescript/src/useCurrentRender.d.ts +2 -2
  327. package/lib/typescript/src/useCurrentRender.d.ts.map +1 -1
  328. package/lib/typescript/src/useDescriptors.d.ts +12 -10
  329. package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
  330. package/lib/typescript/src/useEventEmitter.d.ts +2 -2
  331. package/lib/typescript/src/useEventEmitter.d.ts.map +1 -1
  332. package/lib/typescript/src/useFocusEffect.d.ts +2 -2
  333. package/lib/typescript/src/useFocusEffect.d.ts.map +1 -1
  334. package/lib/typescript/src/useFocusEvents.d.ts +2 -2
  335. package/lib/typescript/src/useFocusEvents.d.ts.map +1 -1
  336. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +2 -2
  337. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -1
  338. package/lib/typescript/src/useIsFocused.d.ts +1 -1
  339. package/lib/typescript/src/useIsFocused.d.ts.map +1 -1
  340. package/lib/typescript/src/useKeyedChildListeners.d.ts +1 -1
  341. package/lib/typescript/src/useKeyedChildListeners.d.ts.map +1 -1
  342. package/lib/typescript/src/useNavigation.d.ts +1 -1
  343. package/lib/typescript/src/useNavigation.d.ts.map +1 -1
  344. package/lib/typescript/src/useNavigationBuilder.d.ts +20 -16
  345. package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
  346. package/lib/typescript/src/useNavigationCache.d.ts +4 -4
  347. package/lib/typescript/src/useNavigationCache.d.ts.map +1 -1
  348. package/lib/typescript/src/useNavigationContainerRef.d.ts +1 -1
  349. package/lib/typescript/src/useNavigationContainerRef.d.ts.map +1 -1
  350. package/lib/typescript/src/useNavigationHelpers.d.ts +28 -10
  351. package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -1
  352. package/lib/typescript/src/useNavigationIndependentTree.d.ts +2 -0
  353. package/lib/typescript/src/useNavigationIndependentTree.d.ts.map +1 -0
  354. package/lib/typescript/src/useNavigationState.d.ts +2 -2
  355. package/lib/typescript/src/useNavigationState.d.ts.map +1 -1
  356. package/lib/typescript/src/useOnAction.d.ts +2 -2
  357. package/lib/typescript/src/useOnAction.d.ts.map +1 -1
  358. package/lib/typescript/src/useOnGetState.d.ts +2 -2
  359. package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
  360. package/lib/typescript/src/useOnPreventRemove.d.ts +2 -2
  361. package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -1
  362. package/lib/typescript/src/useOnRouteFocus.d.ts +2 -2
  363. package/lib/typescript/src/useOnRouteFocus.d.ts.map +1 -1
  364. package/lib/typescript/src/useOptionsGetters.d.ts +2 -2
  365. package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -1
  366. package/lib/typescript/src/usePreventRemove.d.ts +1 -1
  367. package/lib/typescript/src/usePreventRemove.d.ts.map +1 -1
  368. package/lib/typescript/src/usePreventRemoveContext.d.ts +1 -1
  369. package/lib/typescript/src/usePreventRemoveContext.d.ts.map +1 -1
  370. package/lib/typescript/src/useRegisterNavigator.d.ts +1 -1
  371. package/lib/typescript/src/useRegisterNavigator.d.ts.map +1 -1
  372. package/lib/typescript/src/useRoute.d.ts +1 -1
  373. package/lib/typescript/src/useRoute.d.ts.map +1 -1
  374. package/lib/typescript/src/useRouteCache.d.ts +1 -1
  375. package/lib/typescript/src/useRouteCache.d.ts.map +1 -1
  376. package/lib/typescript/src/useScheduleUpdate.d.ts +1 -1
  377. package/lib/typescript/src/useScheduleUpdate.d.ts.map +1 -1
  378. package/lib/typescript/src/useSyncState.d.ts +1 -1
  379. package/lib/typescript/src/useSyncState.d.ts.map +1 -1
  380. package/lib/typescript/src/validatePathConfig.d.ts +1 -1
  381. package/lib/typescript/src/validatePathConfig.d.ts.map +1 -1
  382. package/package.json +11 -11
  383. package/src/BaseNavigationContainer.tsx +82 -80
  384. package/src/CurrentRenderContext.tsx +1 -3
  385. package/src/DeprecatedNavigationInChildContext.tsx +6 -0
  386. package/src/EnsureSingleNavigator.tsx +1 -1
  387. package/src/Group.tsx +1 -1
  388. package/src/NavigationBuilderContext.tsx +1 -3
  389. package/src/NavigationContainerRefContext.tsx +1 -3
  390. package/src/NavigationContext.tsx +1 -3
  391. package/src/NavigationHelpersContext.tsx +1 -3
  392. package/src/NavigationIndependentTree.tsx +25 -0
  393. package/src/NavigationIndependentTreeContext.tsx +6 -0
  394. package/src/NavigationRouteContext.tsx +3 -5
  395. package/src/NavigationStateContext.tsx +1 -1
  396. package/src/PreventRemoveContext.tsx +1 -3
  397. package/src/PreventRemoveProvider.tsx +4 -4
  398. package/src/SceneView.tsx +5 -5
  399. package/src/Screen.tsx +1 -1
  400. package/src/StaticContainer.tsx +19 -18
  401. package/src/StaticNavigation.tsx +401 -0
  402. package/src/UnhandledActionContext.tsx +1 -3
  403. package/src/checkDuplicateRouteNames.tsx +1 -1
  404. package/src/checkSerializable.tsx +1 -1
  405. package/src/createNavigationContainerRef.tsx +1 -1
  406. package/src/createNavigatorFactory.tsx +41 -12
  407. package/src/findFocusedRoute.tsx +1 -1
  408. package/src/fromEntries.tsx +1 -3
  409. package/src/getActionFromState.tsx +3 -9
  410. package/src/getFocusedRouteNameFromRoute.tsx +1 -1
  411. package/src/getPathFromState.tsx +4 -4
  412. package/src/getStateFromPath.tsx +3 -3
  413. package/src/index.tsx +34 -25
  414. package/src/isArrayEqual.tsx +1 -1
  415. package/src/isRecordEqual.tsx +1 -4
  416. package/src/types.tsx +111 -29
  417. package/src/useChildListeners.tsx +1 -1
  418. package/src/useComponent.tsx +1 -1
  419. package/src/useCurrentRender.tsx +2 -6
  420. package/src/useDescriptors.tsx +32 -26
  421. package/src/useEventEmitter.tsx +1 -1
  422. package/src/useFocusEffect.tsx +2 -2
  423. package/src/useFocusEvents.tsx +2 -2
  424. package/src/useFocusedListenersChildrenAdapter.tsx +3 -2
  425. package/src/useIsFocused.tsx +2 -2
  426. package/src/useKeyedChildListeners.tsx +1 -1
  427. package/src/useNavigation.tsx +3 -3
  428. package/src/useNavigationBuilder.tsx +33 -28
  429. package/src/useNavigationCache.tsx +10 -6
  430. package/src/useNavigationContainerRef.tsx +2 -2
  431. package/src/useNavigationHelpers.tsx +3 -3
  432. package/src/useNavigationIndependentTree.tsx +7 -0
  433. package/src/useNavigationState.tsx +2 -2
  434. package/src/useOnAction.tsx +17 -8
  435. package/src/useOnGetState.tsx +5 -7
  436. package/src/useOnPreventRemove.tsx +4 -3
  437. package/src/useOnRouteFocus.tsx +2 -2
  438. package/src/useOptionsGetters.tsx +3 -7
  439. package/src/usePreventRemove.tsx +4 -4
  440. package/src/usePreventRemoveContext.tsx +2 -2
  441. package/src/useRegisterNavigator.tsx +1 -1
  442. package/src/useRoute.tsx +2 -2
  443. package/src/useRouteCache.tsx +1 -1
  444. package/src/useScheduleUpdate.tsx +1 -1
  445. package/src/useSyncState.tsx +1 -1
  446. package/src/validatePathConfig.tsx +1 -1
@@ -13,14 +13,14 @@ import {
13
13
  import * as React from 'react';
14
14
  import { isValidElementType } from 'react-is';
15
15
 
16
- import Group from './Group';
17
- import isArrayEqual from './isArrayEqual';
18
- import isRecordEqual from './isRecordEqual';
19
- import NavigationHelpersContext from './NavigationHelpersContext';
20
- import NavigationRouteContext from './NavigationRouteContext';
21
- import NavigationStateContext from './NavigationStateContext';
22
- import PreventRemoveProvider from './PreventRemoveProvider';
23
- import Screen from './Screen';
16
+ import { Group } from './Group';
17
+ import { isArrayEqual } from './isArrayEqual';
18
+ import { isRecordEqual } from './isRecordEqual';
19
+ import { NavigationHelpersContext } from './NavigationHelpersContext';
20
+ import { NavigationRouteContext } from './NavigationRouteContext';
21
+ import { NavigationStateContext } from './NavigationStateContext';
22
+ import { PreventRemoveProvider } from './PreventRemoveProvider';
23
+ import { Screen } from './Screen';
24
24
  import {
25
25
  DefaultNavigatorOptions,
26
26
  EventMapBase,
@@ -30,20 +30,20 @@ import {
30
30
  RouteConfig,
31
31
  RouteProp,
32
32
  } from './types';
33
- import useChildListeners from './useChildListeners';
34
- import useComponent from './useComponent';
35
- import useCurrentRender from './useCurrentRender';
36
- import useDescriptors, { ScreenConfigWithParent } from './useDescriptors';
37
- import useEventEmitter from './useEventEmitter';
38
- import useFocusedListenersChildrenAdapter from './useFocusedListenersChildrenAdapter';
39
- import useFocusEvents from './useFocusEvents';
40
- import useKeyedChildListeners from './useKeyedChildListeners';
41
- import useNavigationHelpers from './useNavigationHelpers';
42
- import useOnAction from './useOnAction';
43
- import useOnGetState from './useOnGetState';
44
- import useOnRouteFocus from './useOnRouteFocus';
45
- import useRegisterNavigator from './useRegisterNavigator';
46
- import useScheduleUpdate from './useScheduleUpdate';
33
+ import { useChildListeners } from './useChildListeners';
34
+ import { useComponent } from './useComponent';
35
+ import { useCurrentRender } from './useCurrentRender';
36
+ import { ScreenConfigWithParent, useDescriptors } from './useDescriptors';
37
+ import { useEventEmitter } from './useEventEmitter';
38
+ import { useFocusedListenersChildrenAdapter } from './useFocusedListenersChildrenAdapter';
39
+ import { useFocusEvents } from './useFocusEvents';
40
+ import { useKeyedChildListeners } from './useKeyedChildListeners';
41
+ import { useNavigationHelpers } from './useNavigationHelpers';
42
+ import { useOnAction } from './useOnAction';
43
+ import { useOnGetState } from './useOnGetState';
44
+ import { useOnRouteFocus } from './useOnRouteFocus';
45
+ import { useRegisterNavigator } from './useRegisterNavigator';
46
+ import { useScheduleUpdate } from './useScheduleUpdate';
47
47
 
48
48
  // This is to make TypeScript compiler happy
49
49
  // eslint-disable-next-line babel/no-unused-expressions
@@ -63,9 +63,9 @@ type NavigationBuilderOptions<ScreenOptions extends {}> = {
63
63
  }) => ScreenOptions);
64
64
  };
65
65
 
66
- type NavigatorRoute<State extends NavigationState> = {
66
+ type NavigatorRoute = {
67
67
  key: string;
68
- params?: NavigatorScreenParams<ParamListBase, State>;
68
+ params?: NavigatorScreenParams<ParamListBase>;
69
69
  };
70
70
 
71
71
  const isValidKey = (key: unknown) =>
@@ -153,7 +153,12 @@ const getRouteConfigsFromChildren = <
153
153
  ? `'${
154
154
  typeof child.type === 'string' ? child.type : child.type?.name
155
155
  }'${
156
- child.props?.name ? ` for the screen '${child.props.name}'` : ''
156
+ child.props != null &&
157
+ typeof child.props === 'object' &&
158
+ 'name' in child.props &&
159
+ child.props?.name
160
+ ? ` for the screen '${child.props.name}'`
161
+ : ''
157
162
  }`
158
163
  : typeof child === 'object'
159
164
  ? JSON.stringify(child)
@@ -247,7 +252,7 @@ const getRouteConfigsFromChildren = <
247
252
  * @param options Options object containing `children` and additional options for the router.
248
253
  * @returns An object containing `state`, `navigation`, `descriptors` objects.
249
254
  */
250
- export default function useNavigationBuilder<
255
+ export function useNavigationBuilder<
251
256
  State extends NavigationState,
252
257
  RouterOptions extends DefaultRouterOptions,
253
258
  ActionHelpers extends Record<string, () => void>,
@@ -267,7 +272,7 @@ export default function useNavigationBuilder<
267
272
  const navigatorKey = useRegisterNavigator();
268
273
 
269
274
  const route = React.useContext(NavigationRouteContext) as
270
- | NavigatorRoute<State>
275
+ | NavigatorRoute
271
276
  | undefined;
272
277
 
273
278
  const { children, screenListeners, ...rest } = options;
@@ -417,7 +422,7 @@ export default function useNavigationBuilder<
417
422
  } else {
418
423
  return [
419
424
  router.getRehydratedState(
420
- route?.params?.state ?? (currentState as PartialState<State>),
425
+ (route?.params?.state ?? currentState) as PartialState<State>,
421
426
  {
422
427
  routeNames,
423
428
  routeParamList: initialRouteParamList,
@@ -7,12 +7,13 @@ import {
7
7
  } from '@react-navigation/routers';
8
8
  import * as React from 'react';
9
9
 
10
- import NavigationBuilderContext from './NavigationBuilderContext';
10
+ import { NavigationBuilderContext } from './NavigationBuilderContext';
11
11
  import type { NavigationHelpers, NavigationProp } from './types';
12
12
  import type { NavigationEventEmitter } from './useEventEmitter';
13
13
 
14
14
  type Options<
15
15
  State extends NavigationState,
16
+ ScreenOptions extends {},
16
17
  EventMap extends Record<string, any>
17
18
  > = {
18
19
  state: State;
@@ -20,7 +21,9 @@ type Options<
20
21
  navigation: NavigationHelpers<ParamListBase> &
21
22
  Partial<NavigationProp<ParamListBase, string, any, any, any>>;
22
23
  setOptions: (
23
- cb: (options: Record<string, object>) => Record<string, object>
24
+ cb: (
25
+ options: Record<string, ScreenOptions>
26
+ ) => Record<string, ScreenOptions>
24
27
  ) => void;
25
28
  router: Router<State, NavigationAction>;
26
29
  emitter: NavigationEventEmitter<EventMap>;
@@ -47,7 +50,7 @@ type NavigationCache<
47
50
  * It's important to cache them to make sure navigation objects don't change between renders.
48
51
  * This lets us apply optimizations like `React.memo` to minimize re-rendering screens.
49
52
  */
50
- export default function useNavigationCache<
53
+ export function useNavigationCache<
51
54
  State extends NavigationState,
52
55
  ScreenOptions extends {},
53
56
  EventMap extends Record<string, any>
@@ -58,7 +61,7 @@ export default function useNavigationCache<
58
61
  setOptions,
59
62
  router,
60
63
  emitter,
61
- }: Options<State, EventMap>) {
64
+ }: Options<State, ScreenOptions, EventMap>) {
62
65
  const { stackRef } = React.useContext(NavigationBuilderContext);
63
66
 
64
67
  // Cache object which holds navigation objects for each screen
@@ -149,11 +152,12 @@ export default function useNavigationCache<
149
152
 
150
153
  return rest.getParent(id);
151
154
  },
152
- setOptions: (options: object) =>
155
+ setOptions: (options: object) => {
153
156
  setOptions((o) => ({
154
157
  ...o,
155
158
  [route.key]: { ...o[route.key], ...options },
156
- })),
159
+ }));
160
+ },
157
161
  isFocused: () => {
158
162
  const state = getState();
159
163
 
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
 
3
- import createNavigationContainerRef from './createNavigationContainerRef';
3
+ import { createNavigationContainerRef } from './createNavigationContainerRef';
4
4
  import type { NavigationContainerRefWithCurrent } from './types';
5
5
 
6
- export default function useNavigationContainerRef<
6
+ export function useNavigationContainerRef<
7
7
  ParamList extends {} = ReactNavigation.RootParamList
8
8
  >(): NavigationContainerRefWithCurrent<ParamList> {
9
9
  const navigation =
@@ -7,9 +7,9 @@ import {
7
7
  } from '@react-navigation/routers';
8
8
  import * as React from 'react';
9
9
 
10
- import NavigationContext from './NavigationContext';
10
+ import { NavigationContext } from './NavigationContext';
11
11
  import { NavigationHelpers, PrivateValueStore } from './types';
12
- import UnhandledActionContext from './UnhandledActionContext';
12
+ import { UnhandledActionContext } from './UnhandledActionContext';
13
13
  import type { NavigationEventEmitter } from './useEventEmitter';
14
14
 
15
15
  // This is to make TypeScript compiler happy
@@ -28,7 +28,7 @@ type Options<State extends NavigationState, Action extends NavigationAction> = {
28
28
  * Navigation object with helper methods to be used by a navigator.
29
29
  * This object includes methods for common actions as well as methods the parent screen's navigation object.
30
30
  */
31
- export default function useNavigationHelpers<
31
+ export function useNavigationHelpers<
32
32
  State extends NavigationState,
33
33
  ActionHelpers extends Record<string, () => void>,
34
34
  Action extends NavigationAction,
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+
3
+ import { NavigationIndependentTreeContext } from './NavigationIndependentTreeContext';
4
+
5
+ export function useNavigationIndependentTree() {
6
+ return React.useContext(NavigationIndependentTreeContext);
7
+ }
@@ -2,7 +2,7 @@ import type { NavigationState, ParamListBase } from '@react-navigation/routers';
2
2
  import * as React from 'react';
3
3
 
4
4
  import type { NavigationProp } from './types';
5
- import useNavigation from './useNavigation';
5
+ import { useNavigation } from './useNavigation';
6
6
 
7
7
  type Selector<ParamList extends ParamListBase, T> = (
8
8
  state: NavigationState<ParamList>
@@ -13,7 +13,7 @@ type Selector<ParamList extends ParamListBase, T> = (
13
13
  *
14
14
  * @param selector Selector function to get a value from the state.
15
15
  */
16
- export default function useNavigationState<ParamList extends ParamListBase, T>(
16
+ export function useNavigationState<ParamList extends ParamListBase, T>(
17
17
  selector: Selector<ParamList, T>
18
18
  ): T {
19
19
  const navigation = useNavigation<NavigationProp<ParamList>>();
@@ -7,13 +7,15 @@ import type {
7
7
  } from '@react-navigation/routers';
8
8
  import * as React from 'react';
9
9
 
10
- import NavigationBuilderContext, {
10
+ import { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';
11
+ import {
11
12
  ChildActionListener,
12
13
  ChildBeforeRemoveListener,
14
+ NavigationBuilderContext,
13
15
  } from './NavigationBuilderContext';
14
16
  import type { EventMapCore } from './types';
15
17
  import type { NavigationEventEmitter } from './useEventEmitter';
16
- import useOnPreventRemove, { shouldPreventRemove } from './useOnPreventRemove';
18
+ import { shouldPreventRemove, useOnPreventRemove } from './useOnPreventRemove';
17
19
 
18
20
  type Options = {
19
21
  router: Router<NavigationState, NavigationAction>;
@@ -35,7 +37,7 @@ type Options = {
35
37
  *
36
38
  * When the action handler handles as action, it returns `true`, otherwise `false`.
37
39
  */
38
- export default function useOnAction({
40
+ export function useOnAction({
39
41
  router,
40
42
  getState,
41
43
  setState,
@@ -51,6 +53,9 @@ export default function useOnAction({
51
53
  addListener: addListenerParent,
52
54
  onDispatchAction,
53
55
  } = React.useContext(NavigationBuilderContext);
56
+ const navigationInChildEnabled = React.useContext(
57
+ DeprecatedNavigationInChildContext
58
+ );
54
59
 
55
60
  const routerConfigOptionsRef =
56
61
  React.useRef<RouterConfigOptions>(routerConfigOptions);
@@ -126,12 +131,15 @@ export default function useOnAction({
126
131
  }
127
132
  }
128
133
 
129
- // If the action wasn't handled by current navigator or a parent navigator, let children handle it
130
- for (let i = actionListeners.length - 1; i >= 0; i--) {
131
- const listener = actionListeners[i];
134
+ if (typeof action.target === 'string' || navigationInChildEnabled) {
135
+ // If the action wasn't handled by current navigator or a parent navigator, let children handle it
136
+ // Handling this when target isn't specified is deprecated and will be removed in the future
137
+ for (let i = actionListeners.length - 1; i >= 0; i--) {
138
+ const listener = actionListeners[i];
132
139
 
133
- if (listener(action, visitedNavigators)) {
134
- return true;
140
+ if (listener(action, visitedNavigators)) {
141
+ return true;
142
+ }
135
143
  }
136
144
  }
137
145
 
@@ -142,6 +150,7 @@ export default function useOnAction({
142
150
  beforeRemoveListeners,
143
151
  emitter,
144
152
  getState,
153
+ navigationInChildEnabled,
145
154
  key,
146
155
  onActionParent,
147
156
  onDispatchAction,
@@ -1,21 +1,19 @@
1
1
  import type { NavigationState } from '@react-navigation/routers';
2
2
  import * as React from 'react';
3
3
 
4
- import isArrayEqual from './isArrayEqual';
5
- import NavigationBuilderContext, {
4
+ import { isArrayEqual } from './isArrayEqual';
5
+ import {
6
6
  GetStateListener,
7
+ NavigationBuilderContext,
7
8
  } from './NavigationBuilderContext';
8
- import NavigationRouteContext from './NavigationRouteContext';
9
+ import { NavigationRouteContext } from './NavigationRouteContext';
9
10
 
10
11
  type Options = {
11
12
  getState: () => NavigationState;
12
13
  getStateListeners: Record<string, GetStateListener | undefined>;
13
14
  };
14
15
 
15
- export default function useOnGetState({
16
- getState,
17
- getStateListeners,
18
- }: Options) {
16
+ export function useOnGetState({ getState, getStateListeners }: Options) {
19
17
  const { addKeyedListener } = React.useContext(NavigationBuilderContext);
20
18
  const route = React.useContext(NavigationRouteContext);
21
19
  const key = route ? route.key : 'root';
@@ -4,10 +4,11 @@ import type {
4
4
  } from '@react-navigation/routers';
5
5
  import * as React from 'react';
6
6
 
7
- import NavigationBuilderContext, {
7
+ import {
8
8
  ChildBeforeRemoveListener,
9
+ NavigationBuilderContext,
9
10
  } from './NavigationBuilderContext';
10
- import NavigationRouteContext from './NavigationRouteContext';
11
+ import { NavigationRouteContext } from './NavigationRouteContext';
11
12
  import type { EventMapCore } from './types';
12
13
  import type { NavigationEventEmitter } from './useEventEmitter';
13
14
 
@@ -72,7 +73,7 @@ export const shouldPreventRemove = (
72
73
  return false;
73
74
  };
74
75
 
75
- export default function useOnPreventRemove({
76
+ export function useOnPreventRemove({
76
77
  getState,
77
78
  emitter,
78
79
  beforeRemoveListeners,
@@ -5,7 +5,7 @@ import type {
5
5
  } from '@react-navigation/routers';
6
6
  import * as React from 'react';
7
7
 
8
- import NavigationBuilderContext from './NavigationBuilderContext';
8
+ import { NavigationBuilderContext } from './NavigationBuilderContext';
9
9
 
10
10
  type Options<Action extends NavigationAction> = {
11
11
  router: Router<NavigationState, Action>;
@@ -19,7 +19,7 @@ type Options<Action extends NavigationAction> = {
19
19
  * Focus action needs to be treated specially, coz when a nested route is focused,
20
20
  * the parent navigators also needs to be focused.
21
21
  */
22
- export default function useOnRouteFocus<Action extends NavigationAction>({
22
+ export function useOnRouteFocus<Action extends NavigationAction>({
23
23
  router,
24
24
  getState,
25
25
  key: sourceRouteKey,
@@ -1,8 +1,8 @@
1
1
  import type { ParamListBase } from '@react-navigation/routers';
2
2
  import * as React from 'react';
3
3
 
4
- import NavigationBuilderContext from './NavigationBuilderContext';
5
- import NavigationStateContext from './NavigationStateContext';
4
+ import { NavigationBuilderContext } from './NavigationBuilderContext';
5
+ import { NavigationStateContext } from './NavigationStateContext';
6
6
  import type { NavigationProp } from './types';
7
7
 
8
8
  type Options = {
@@ -11,11 +11,7 @@ type Options = {
11
11
  options?: object | undefined;
12
12
  };
13
13
 
14
- export default function useOptionsGetters({
15
- key,
16
- options,
17
- navigation,
18
- }: Options) {
14
+ export function useOptionsGetters({ key, options, navigation }: Options) {
19
15
  const optionsRef = React.useRef<object | undefined>(options);
20
16
  const optionsGettersFromChildRef = React.useRef<
21
17
  Record<string, () => object | undefined | null>
@@ -4,9 +4,9 @@ import * as React from 'react';
4
4
  import useLatestCallback from 'use-latest-callback';
5
5
 
6
6
  import type { EventListenerCallback, EventMapCore } from './types';
7
- import useNavigation from './useNavigation';
8
- import usePreventRemoveContext from './usePreventRemoveContext';
9
- import useRoute from './useRoute';
7
+ import { useNavigation } from './useNavigation';
8
+ import { usePreventRemoveContext } from './usePreventRemoveContext';
9
+ import { useRoute } from './useRoute';
10
10
 
11
11
  /**
12
12
  * Hook to prevent screen from being removed. Can be used to prevent users from leaving the screen.
@@ -14,7 +14,7 @@ import useRoute from './useRoute';
14
14
  * @param preventRemove Boolean indicating whether to prevent screen from being removed.
15
15
  * @param callback Function which is executed when screen was prevented from being removed.
16
16
  */
17
- export default function usePreventRemove(
17
+ export function UNSTABLE_usePreventRemove(
18
18
  preventRemove: boolean,
19
19
  callback: (options: { data: { action: NavigationAction } }) => void
20
20
  ) {
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
 
3
- import PreventRemoveContext from './PreventRemoveContext';
3
+ import { PreventRemoveContext } from './PreventRemoveContext';
4
4
 
5
- export default function usePreventRemoveContext() {
5
+ export function usePreventRemoveContext() {
6
6
  const value = React.useContext(PreventRemoveContext);
7
7
 
8
8
  if (value == null) {
@@ -7,7 +7,7 @@ import { SingleNavigatorContext } from './EnsureSingleNavigator';
7
7
  * Register a navigator in the parent context (either a navigation container or a screen).
8
8
  * This is used to prevent multiple navigators under a single container or screen.
9
9
  */
10
- export default function useRegisterNavigator() {
10
+ export function useRegisterNavigator() {
11
11
  const [key] = React.useState(() => nanoid());
12
12
  const container = React.useContext(SingleNavigatorContext);
13
13
 
package/src/useRoute.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ParamListBase } from '@react-navigation/routers';
2
2
  import * as React from 'react';
3
3
 
4
- import NavigationRouteContext from './NavigationRouteContext';
4
+ import { NavigationRouteContext } from './NavigationRouteContext';
5
5
  import type { RouteProp } from './types';
6
6
 
7
7
  /**
@@ -9,7 +9,7 @@ import type { RouteProp } from './types';
9
9
  *
10
10
  * @returns Route prop of the parent screen.
11
11
  */
12
- export default function useRoute<T extends RouteProp<ParamListBase>>(): T {
12
+ export function useRoute<T extends RouteProp<ParamListBase>>(): T {
13
13
  const route = React.useContext(NavigationRouteContext);
14
14
 
15
15
  if (route === undefined) {
@@ -20,7 +20,7 @@ export const CHILD_STATE = Symbol('CHILD_STATE');
20
20
  * Hook to cache route props for each screen in the navigator.
21
21
  * This lets add warnings and modifications to the route object but keep references between renders.
22
22
  */
23
- export default function useRouteCache<State extends NavigationState>(
23
+ export function useRouteCache<State extends NavigationState>(
24
24
  routes: State['routes']
25
25
  ) {
26
26
  // Cache object which holds route objects for each screen
@@ -21,7 +21,7 @@ export const ScheduleUpdateContext = React.createContext<{
21
21
  * It lets all subsequent updates access the latest state so it stays correct.
22
22
  * Then we call setState during after the component updates.
23
23
  */
24
- export default function useScheduleUpdate(callback: () => void) {
24
+ export function useScheduleUpdate(callback: () => void) {
25
25
  const { scheduleUpdate, flushUpdates } = React.useContext(
26
26
  ScheduleUpdateContext
27
27
  );
@@ -5,7 +5,7 @@ const UNINTIALIZED_STATE = {};
5
5
  /**
6
6
  * This is definitely not compatible with concurrent mode, but we don't have a solution for sync state yet.
7
7
  */
8
- export default function useSyncState<T>(initialState?: (() => T) | T) {
8
+ export function useSyncState<T>(initialState?: (() => T) | T) {
9
9
  const stateRef = React.useRef<T>(UNINTIALIZED_STATE as any);
10
10
  const isSchedulingRef = React.useRef(false);
11
11
  const isMountedRef = React.useRef(true);
@@ -1,7 +1,7 @@
1
1
  const formatToList = (items: string[]) =>
2
2
  items.map((key) => `- ${key}`).join('\n');
3
3
 
4
- export default function validatePathConfig(config: any, root = true) {
4
+ export function validatePathConfig(config: any, root = true) {
5
5
  const validKeys = ['initialRouteName', 'screens'];
6
6
 
7
7
  if (!root) {