@react-navigation/core 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/lib/commonjs/BaseNavigationContainer.js +393 -0
  4. package/lib/commonjs/BaseNavigationContainer.js.map +1 -0
  5. package/lib/commonjs/CurrentRenderContext.js +21 -0
  6. package/lib/commonjs/CurrentRenderContext.js.map +1 -0
  7. package/lib/commonjs/EnsureSingleNavigator.js +53 -0
  8. package/lib/commonjs/EnsureSingleNavigator.js.map +1 -0
  9. package/lib/commonjs/Group.js +15 -0
  10. package/lib/commonjs/Group.js.map +1 -0
  11. package/lib/commonjs/NavigationBuilderContext.js +23 -0
  12. package/lib/commonjs/NavigationBuilderContext.js.map +1 -0
  13. package/lib/commonjs/NavigationContainerRefContext.js +20 -0
  14. package/lib/commonjs/NavigationContainerRefContext.js.map +1 -0
  15. package/lib/commonjs/NavigationContext.js +20 -0
  16. package/lib/commonjs/NavigationContext.js.map +1 -0
  17. package/lib/commonjs/NavigationHelpersContext.js +21 -0
  18. package/lib/commonjs/NavigationHelpersContext.js.map +1 -0
  19. package/lib/commonjs/NavigationRouteContext.js +20 -0
  20. package/lib/commonjs/NavigationRouteContext.js.map +1 -0
  21. package/lib/commonjs/NavigationStateContext.js +42 -0
  22. package/lib/commonjs/NavigationStateContext.js.map +1 -0
  23. package/lib/commonjs/SceneView.js +97 -0
  24. package/lib/commonjs/SceneView.js.map +1 -0
  25. package/lib/commonjs/Screen.js +15 -0
  26. package/lib/commonjs/Screen.js.map +1 -0
  27. package/lib/commonjs/StaticContainer.js +43 -0
  28. package/lib/commonjs/StaticContainer.js.map +1 -0
  29. package/lib/commonjs/UnhandledActionContext.js +17 -0
  30. package/lib/commonjs/UnhandledActionContext.js.map +1 -0
  31. package/lib/commonjs/checkDuplicateRouteNames.js +31 -0
  32. package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -0
  33. package/lib/commonjs/checkSerializable.js +59 -0
  34. package/lib/commonjs/checkSerializable.js.map +1 -0
  35. package/lib/commonjs/createNavigationContainerRef.js +82 -0
  36. package/lib/commonjs/createNavigationContainerRef.js.map +1 -0
  37. package/lib/commonjs/createNavigatorFactory.js +34 -0
  38. package/lib/commonjs/createNavigatorFactory.js.map +1 -0
  39. package/lib/commonjs/findFocusedRoute.js +22 -0
  40. package/lib/commonjs/findFocusedRoute.js.map +1 -0
  41. package/lib/commonjs/fromEntries.js +19 -0
  42. package/lib/commonjs/fromEntries.js.map +1 -0
  43. package/lib/commonjs/getActionFromState.js +99 -0
  44. package/lib/commonjs/getActionFromState.js.map +1 -0
  45. package/lib/commonjs/getFocusedRouteNameFromRoute.js +23 -0
  46. package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -0
  47. package/lib/commonjs/getPathFromState.js +238 -0
  48. package/lib/commonjs/getPathFromState.js.map +1 -0
  49. package/lib/commonjs/getStateFromPath.js +450 -0
  50. package/lib/commonjs/getStateFromPath.js.map +1 -0
  51. package/lib/commonjs/index.js +227 -0
  52. package/lib/commonjs/index.js.map +1 -0
  53. package/lib/commonjs/isArrayEqual.js +15 -0
  54. package/lib/commonjs/isArrayEqual.js.map +1 -0
  55. package/lib/commonjs/types.js +18 -0
  56. package/lib/commonjs/types.js.map +1 -0
  57. package/lib/commonjs/useChildListeners.js +38 -0
  58. package/lib/commonjs/useChildListeners.js.map +1 -0
  59. package/lib/commonjs/useComponent.js +36 -0
  60. package/lib/commonjs/useComponent.js.map +1 -0
  61. package/lib/commonjs/useCurrentRender.js +33 -0
  62. package/lib/commonjs/useCurrentRender.js.map +1 -0
  63. package/lib/commonjs/useDescriptors.js +141 -0
  64. package/lib/commonjs/useDescriptors.js.map +1 -0
  65. package/lib/commonjs/useEventEmitter.js +118 -0
  66. package/lib/commonjs/useEventEmitter.js.map +1 -0
  67. package/lib/commonjs/useFocusEffect.js +97 -0
  68. package/lib/commonjs/useFocusEffect.js.map +1 -0
  69. package/lib/commonjs/useFocusEvents.js +77 -0
  70. package/lib/commonjs/useFocusEvents.js.map +1 -0
  71. package/lib/commonjs/useFocusedListenersChildrenAdapter.js +57 -0
  72. package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -0
  73. package/lib/commonjs/useIsFocused.js +47 -0
  74. package/lib/commonjs/useIsFocused.js.map +1 -0
  75. package/lib/commonjs/useKeyedChildListeners.js +35 -0
  76. package/lib/commonjs/useKeyedChildListeners.js.map +1 -0
  77. package/lib/commonjs/useNavigation.js +36 -0
  78. package/lib/commonjs/useNavigation.js.map +1 -0
  79. package/lib/commonjs/useNavigationBuilder.js +480 -0
  80. package/lib/commonjs/useNavigationBuilder.js.map +1 -0
  81. package/lib/commonjs/useNavigationCache.js +122 -0
  82. package/lib/commonjs/useNavigationCache.js.map +1 -0
  83. package/lib/commonjs/useNavigationContainerRef.js +27 -0
  84. package/lib/commonjs/useNavigationContainerRef.js.map +1 -0
  85. package/lib/commonjs/useNavigationHelpers.js +77 -0
  86. package/lib/commonjs/useNavigationHelpers.js.map +1 -0
  87. package/lib/commonjs/useNavigationState.js +41 -0
  88. package/lib/commonjs/useNavigationState.js.map +1 -0
  89. package/lib/commonjs/useOnAction.js +118 -0
  90. package/lib/commonjs/useOnAction.js.map +1 -0
  91. package/lib/commonjs/useOnGetState.js +60 -0
  92. package/lib/commonjs/useOnGetState.js.map +1 -0
  93. package/lib/commonjs/useOnPreventRemove.js +89 -0
  94. package/lib/commonjs/useOnPreventRemove.js.map +1 -0
  95. package/lib/commonjs/useOnRouteFocus.js +45 -0
  96. package/lib/commonjs/useOnRouteFocus.js.map +1 -0
  97. package/lib/commonjs/useOptionsGetters.js +99 -0
  98. package/lib/commonjs/useOptionsGetters.js.map +1 -0
  99. package/lib/commonjs/useRegisterNavigator.js +40 -0
  100. package/lib/commonjs/useRegisterNavigator.js.map +1 -0
  101. package/lib/commonjs/useRoute.js +32 -0
  102. package/lib/commonjs/useRoute.js.map +1 -0
  103. package/lib/commonjs/useRouteCache.js +61 -0
  104. package/lib/commonjs/useRouteCache.js.map +1 -0
  105. package/lib/commonjs/useScheduleUpdate.js +44 -0
  106. package/lib/commonjs/useScheduleUpdate.js.map +1 -0
  107. package/lib/commonjs/useSyncState.js +76 -0
  108. package/lib/commonjs/useSyncState.js.map +1 -0
  109. package/lib/commonjs/validatePathConfig.js +31 -0
  110. package/lib/commonjs/validatePathConfig.js.map +1 -0
  111. package/lib/module/BaseNavigationContainer.js +360 -0
  112. package/lib/module/BaseNavigationContainer.js.map +1 -0
  113. package/lib/module/CurrentRenderContext.js +9 -0
  114. package/lib/module/CurrentRenderContext.js.map +1 -0
  115. package/lib/module/EnsureSingleNavigator.js +38 -0
  116. package/lib/module/EnsureSingleNavigator.js.map +1 -0
  117. package/lib/module/Group.js +8 -0
  118. package/lib/module/Group.js.map +1 -0
  119. package/lib/module/NavigationBuilderContext.js +11 -0
  120. package/lib/module/NavigationBuilderContext.js.map +1 -0
  121. package/lib/module/NavigationContainerRefContext.js +8 -0
  122. package/lib/module/NavigationContainerRefContext.js.map +1 -0
  123. package/lib/module/NavigationContext.js +8 -0
  124. package/lib/module/NavigationContext.js.map +1 -0
  125. package/lib/module/NavigationHelpersContext.js +9 -0
  126. package/lib/module/NavigationHelpersContext.js.map +1 -0
  127. package/lib/module/NavigationRouteContext.js +8 -0
  128. package/lib/module/NavigationRouteContext.js.map +1 -0
  129. package/lib/module/NavigationStateContext.js +27 -0
  130. package/lib/module/NavigationStateContext.js.map +1 -0
  131. package/lib/module/SceneView.js +80 -0
  132. package/lib/module/SceneView.js.map +1 -0
  133. package/lib/module/Screen.js +8 -0
  134. package/lib/module/Screen.js.map +1 -0
  135. package/lib/module/StaticContainer.js +30 -0
  136. package/lib/module/StaticContainer.js.map +1 -0
  137. package/lib/module/UnhandledActionContext.js +4 -0
  138. package/lib/module/UnhandledActionContext.js.map +1 -0
  139. package/lib/module/checkDuplicateRouteNames.js +24 -0
  140. package/lib/module/checkDuplicateRouteNames.js.map +1 -0
  141. package/lib/module/checkSerializable.js +52 -0
  142. package/lib/module/checkSerializable.js.map +1 -0
  143. package/lib/module/createNavigationContainerRef.js +71 -0
  144. package/lib/module/createNavigationContainerRef.js.map +1 -0
  145. package/lib/module/createNavigatorFactory.js +24 -0
  146. package/lib/module/createNavigatorFactory.js.map +1 -0
  147. package/lib/module/findFocusedRoute.js +15 -0
  148. package/lib/module/findFocusedRoute.js.map +1 -0
  149. package/lib/module/fromEntries.js +12 -0
  150. package/lib/module/fromEntries.js.map +1 -0
  151. package/lib/module/getActionFromState.js +92 -0
  152. package/lib/module/getActionFromState.js.map +1 -0
  153. package/lib/module/getFocusedRouteNameFromRoute.js +15 -0
  154. package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -0
  155. package/lib/module/getPathFromState.js +223 -0
  156. package/lib/module/getPathFromState.js.map +1 -0
  157. package/lib/module/getStateFromPath.js +434 -0
  158. package/lib/module/getStateFromPath.js.map +1 -0
  159. package/lib/module/index.js +24 -0
  160. package/lib/module/index.js.map +1 -0
  161. package/lib/module/isArrayEqual.js +8 -0
  162. package/lib/module/isArrayEqual.js.map +1 -0
  163. package/lib/module/types.js +9 -0
  164. package/lib/module/types.js.map +1 -0
  165. package/lib/module/useChildListeners.js +27 -0
  166. package/lib/module/useChildListeners.js.map +1 -0
  167. package/lib/module/useComponent.js +24 -0
  168. package/lib/module/useComponent.js.map +1 -0
  169. package/lib/module/useCurrentRender.js +19 -0
  170. package/lib/module/useCurrentRender.js.map +1 -0
  171. package/lib/module/useDescriptors.js +122 -0
  172. package/lib/module/useDescriptors.js.map +1 -0
  173. package/lib/module/useEventEmitter.js +107 -0
  174. package/lib/module/useEventEmitter.js.map +1 -0
  175. package/lib/module/useFocusEffect.js +83 -0
  176. package/lib/module/useFocusEffect.js.map +1 -0
  177. package/lib/module/useFocusEvents.js +63 -0
  178. package/lib/module/useFocusEvents.js.map +1 -0
  179. package/lib/module/useFocusedListenersChildrenAdapter.js +43 -0
  180. package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -0
  181. package/lib/module/useIsFocused.js +34 -0
  182. package/lib/module/useIsFocused.js.map +1 -0
  183. package/lib/module/useKeyedChildListeners.js +24 -0
  184. package/lib/module/useKeyedChildListeners.js.map +1 -0
  185. package/lib/module/useNavigation.js +21 -0
  186. package/lib/module/useNavigation.js.map +1 -0
  187. package/lib/module/useNavigationBuilder.js +443 -0
  188. package/lib/module/useNavigationBuilder.js.map +1 -0
  189. package/lib/module/useNavigationCache.js +107 -0
  190. package/lib/module/useNavigationCache.js.map +1 -0
  191. package/lib/module/useNavigationContainerRef.js +12 -0
  192. package/lib/module/useNavigationContainerRef.js.map +1 -0
  193. package/lib/module/useNavigationHelpers.js +59 -0
  194. package/lib/module/useNavigationHelpers.js.map +1 -0
  195. package/lib/module/useNavigationState.js +27 -0
  196. package/lib/module/useNavigationState.js.map +1 -0
  197. package/lib/module/useOnAction.js +103 -0
  198. package/lib/module/useOnAction.js.map +1 -0
  199. package/lib/module/useOnGetState.js +43 -0
  200. package/lib/module/useOnGetState.js.map +1 -0
  201. package/lib/module/useOnPreventRemove.js +68 -0
  202. package/lib/module/useOnPreventRemove.js.map +1 -0
  203. package/lib/module/useOnRouteFocus.js +31 -0
  204. package/lib/module/useOnRouteFocus.js.map +1 -0
  205. package/lib/module/useOptionsGetters.js +83 -0
  206. package/lib/module/useOptionsGetters.js.map +1 -0
  207. package/lib/module/useRegisterNavigator.js +27 -0
  208. package/lib/module/useRegisterNavigator.js.map +1 -0
  209. package/lib/module/useRoute.js +18 -0
  210. package/lib/module/useRoute.js.map +1 -0
  211. package/lib/module/useRouteCache.js +47 -0
  212. package/lib/module/useRouteCache.js.map +1 -0
  213. package/lib/module/useScheduleUpdate.js +29 -0
  214. package/lib/module/useScheduleUpdate.js.map +1 -0
  215. package/lib/module/useSyncState.js +64 -0
  216. package/lib/module/useSyncState.js.map +1 -0
  217. package/lib/module/validatePathConfig.js +24 -0
  218. package/lib/module/validatePathConfig.js.map +1 -0
  219. package/lib/typescript/src/BaseNavigationContainer.d.ts +14 -0
  220. package/lib/typescript/src/CurrentRenderContext.d.ts +9 -0
  221. package/lib/typescript/src/EnsureSingleNavigator.d.ts +13 -0
  222. package/lib/typescript/src/Group.d.ts +6 -0
  223. package/lib/typescript/src/NavigationBuilderContext.d.ts +34 -0
  224. package/lib/typescript/src/NavigationContainerRefContext.d.ts +8 -0
  225. package/lib/typescript/src/NavigationContext.d.ts +24 -0
  226. package/lib/typescript/src/NavigationHelpersContext.d.ts +9 -0
  227. package/lib/typescript/src/NavigationRouteContext.d.ts +7 -0
  228. package/lib/typescript/src/NavigationStateContext.d.ts +45 -0
  229. package/lib/typescript/src/SceneView.d.ts +21 -0
  230. package/lib/typescript/src/Screen.d.ts +6 -0
  231. package/lib/typescript/src/StaticContainer.d.ts +7 -0
  232. package/lib/typescript/src/UnhandledActionContext.d.ts +4 -0
  233. package/lib/typescript/src/checkDuplicateRouteNames.d.ts +2 -0
  234. package/lib/typescript/src/checkSerializable.d.ts +9 -0
  235. package/lib/typescript/src/createNavigationContainerRef.d.ts +3 -0
  236. package/lib/typescript/src/createNavigatorFactory.d.ts +11 -0
  237. package/lib/typescript/src/findFocusedRoute.d.ts +22 -0
  238. package/lib/typescript/src/fromEntries.d.ts +1 -0
  239. package/lib/typescript/src/getActionFromState.d.ts +16 -0
  240. package/lib/typescript/src/getFocusedRouteNameFromRoute.d.ts +2 -0
  241. package/lib/typescript/src/getPathFromState.d.ts +38 -0
  242. package/lib/typescript/src/getStateFromPath.d.ts +32 -0
  243. package/lib/typescript/src/index.d.ts +23 -0
  244. package/lib/typescript/src/isArrayEqual.d.ts +5 -0
  245. package/lib/typescript/src/types.d.ts +485 -0
  246. package/lib/typescript/src/useChildListeners.d.ts +11 -0
  247. package/lib/typescript/src/useComponent.d.ts +2 -0
  248. package/lib/typescript/src/useCurrentRender.d.ts +13 -0
  249. package/lib/typescript/src/useDescriptors.d.ts +89 -0
  250. package/lib/typescript/src/useEventEmitter.d.ts +8 -0
  251. package/lib/typescript/src/useFocusEffect.d.ts +10 -0
  252. package/lib/typescript/src/useFocusEvents.d.ts +12 -0
  253. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +12 -0
  254. package/lib/typescript/src/useIsFocused.d.ts +5 -0
  255. package/lib/typescript/src/useKeyedChildListeners.d.ts +11 -0
  256. package/lib/typescript/src/useNavigation.d.ts +7 -0
  257. package/lib/typescript/src/useNavigationBuilder.d.ts +223 -0
  258. package/lib/typescript/src/useNavigationCache.d.ts +19 -0
  259. package/lib/typescript/src/useNavigationContainerRef.d.ts +2 -0
  260. package/lib/typescript/src/useNavigationHelpers.d.ts +174 -0
  261. package/lib/typescript/src/useNavigationState.d.ts +9 -0
  262. package/lib/typescript/src/useOnAction.d.ts +25 -0
  263. package/lib/typescript/src/useOnGetState.d.ts +8 -0
  264. package/lib/typescript/src/useOnPreventRemove.d.ts +16 -0
  265. package/lib/typescript/src/useOnRouteFocus.d.ts +14 -0
  266. package/lib/typescript/src/useOptionsGetters.d.ts +12 -0
  267. package/lib/typescript/src/useRegisterNavigator.d.ts +5 -0
  268. package/lib/typescript/src/useRoute.d.ts +8 -0
  269. package/lib/typescript/src/useRouteCache.d.ts +13 -0
  270. package/lib/typescript/src/useScheduleUpdate.d.ts +13 -0
  271. package/lib/typescript/src/useSyncState.d.ts +4 -0
  272. package/lib/typescript/src/validatePathConfig.d.ts +1 -0
  273. package/package.json +73 -0
  274. package/src/BaseNavigationContainer.tsx +453 -0
  275. package/src/CurrentRenderContext.tsx +10 -0
  276. package/src/EnsureSingleNavigator.tsx +53 -0
  277. package/src/Group.tsx +14 -0
  278. package/src/NavigationBuilderContext.tsx +70 -0
  279. package/src/NavigationContainerRefContext.tsx +14 -0
  280. package/src/NavigationContext.tsx +12 -0
  281. package/src/NavigationHelpersContext.tsx +13 -0
  282. package/src/NavigationRouteContext.tsx +10 -0
  283. package/src/NavigationStateContext.tsx +39 -0
  284. package/src/SceneView.tsx +134 -0
  285. package/src/Screen.tsx +17 -0
  286. package/src/StaticContainer.tsx +29 -0
  287. package/src/UnhandledActionContext.tsx +9 -0
  288. package/src/checkDuplicateRouteNames.tsx +33 -0
  289. package/src/checkSerializable.tsx +74 -0
  290. package/src/createNavigationContainerRef.tsx +97 -0
  291. package/src/createNavigatorFactory.tsx +40 -0
  292. package/src/findFocusedRoute.tsx +13 -0
  293. package/src/fromEntries.tsx +13 -0
  294. package/src/getActionFromState.tsx +154 -0
  295. package/src/getFocusedRouteNameFromRoute.tsx +28 -0
  296. package/src/getPathFromState.tsx +297 -0
  297. package/src/getStateFromPath.tsx +575 -0
  298. package/src/index.tsx +23 -0
  299. package/src/isArrayEqual.tsx +7 -0
  300. package/src/types.tsx +645 -0
  301. package/src/useChildListeners.tsx +37 -0
  302. package/src/useComponent.tsx +30 -0
  303. package/src/useCurrentRender.tsx +35 -0
  304. package/src/useDescriptors.tsx +229 -0
  305. package/src/useEventEmitter.tsx +130 -0
  306. package/src/useFocusEffect.tsx +112 -0
  307. package/src/useFocusEvents.tsx +73 -0
  308. package/src/useFocusedListenersChildrenAdapter.tsx +47 -0
  309. package/src/useIsFocused.tsx +43 -0
  310. package/src/useKeyedChildListeners.tsx +40 -0
  311. package/src/useNavigation.tsx +26 -0
  312. package/src/useNavigationBuilder.tsx +640 -0
  313. package/src/useNavigationCache.tsx +159 -0
  314. package/src/useNavigationContainerRef.tsx +17 -0
  315. package/src/useNavigationHelpers.tsx +98 -0
  316. package/src/useNavigationState.tsx +41 -0
  317. package/src/useOnAction.tsx +166 -0
  318. package/src/useOnGetState.tsx +47 -0
  319. package/src/useOnPreventRemove.tsx +99 -0
  320. package/src/useOnRouteFocus.tsx +47 -0
  321. package/src/useOptionsGetters.tsx +98 -0
  322. package/src/useRegisterNavigator.tsx +29 -0
  323. package/src/useRoute.tsx +22 -0
  324. package/src/useRouteCache.tsx +55 -0
  325. package/src/useScheduleUpdate.tsx +32 -0
  326. package/src/useSyncState.tsx +74 -0
  327. package/src/validatePathConfig.tsx +32 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useRouteCache.tsx"],"names":["React","CHILD_STATE","Symbol","useRouteCache","routes","cache","useMemo","current","Map","process","env","NODE_ENV","reduce","acc","route","previous","get","set","state","proxy","Object","defineProperty","enumerable","value","Array","from","values"],"mappings":"AAKA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGC,MAAM,CAAC,aAAD,CAA1B;AAEP;AACA;AACA;AACA;;AACA,eAAe,SAASC,aAAT,CACbC,MADa,EAEb;AACA;AACA,QAAMC,KAAK,GAAGL,KAAK,CAACM,OAAN,CAAc,OAAO;AAAEC,IAAAA,OAAO,EAAE,IAAIC,GAAJ;AAAX,GAAP,CAAd,EAA4D,EAA5D,CAAd;;AAEA,MAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzC;AACA,WAAOP,MAAP;AACD;;AAEDC,EAAAA,KAAK,CAACE,OAAN,GAAgBH,MAAM,CAACQ,MAAP,CAAc,CAACC,GAAD,EAAMC,KAAN,KAAgB;AAC5C,UAAMC,QAAQ,GAAGV,KAAK,CAACE,OAAN,CAAcS,GAAd,CAAkBF,KAAlB,CAAjB;;AAEA,QAAIC,QAAJ,EAAc;AACZ;AACAF,MAAAA,GAAG,CAACI,GAAJ,CAAQH,KAAR,EAAeC,QAAf;AACD,KAHD,MAGO;AACL,YAAM;AAAEG,QAAAA,KAAF;AAAS,WAAGC;AAAZ,UAAsBL,KAA5B;AAEAM,MAAAA,MAAM,CAACC,cAAP,CAAsBF,KAAtB,EAA6BlB,WAA7B,EAA0C;AACxCqB,QAAAA,UAAU,EAAE,KAD4B;AAExCC,QAAAA,KAAK,EAAEL;AAFiC,OAA1C;AAKAL,MAAAA,GAAG,CAACI,GAAJ,CAAQH,KAAR,EAAeK,KAAf;AACD;;AAED,WAAON,GAAP;AACD,GAlBe,EAkBb,IAAIL,GAAJ,EAlBa,CAAhB;AAoBA,SAAOgB,KAAK,CAACC,IAAN,CAAWpB,KAAK,CAACE,OAAN,CAAcmB,MAAd,EAAX,CAAP;AACD","sourcesContent":["import type {\n NavigationState,\n ParamListBase,\n Route,\n} from '@react-navigation/routers';\nimport * as React from 'react';\n\nimport type { RouteProp } from './types';\n\ntype RouteCache = Map<Route<string>, RouteProp<ParamListBase>>;\n\n/**\n * Utilites such as `getFocusedRouteNameFromRoute` need to access state.\n * So we need a way to suppress the warning for those use cases.\n * This is fine since they are internal utilities and this is not public API.\n */\nexport const CHILD_STATE = Symbol('CHILD_STATE');\n\n/**\n * Hook to cache route props for each screen in the navigator.\n * This lets add warnings and modifications to the route object but keep references between renders.\n */\nexport default function useRouteCache<State extends NavigationState>(\n routes: State['routes']\n) {\n // Cache object which holds route objects for each screen\n const cache = React.useMemo(() => ({ current: new Map() as RouteCache }), []);\n\n if (process.env.NODE_ENV === 'production') {\n // We don't want the overhead of creating extra maps every render in prod\n return routes;\n }\n\n cache.current = routes.reduce((acc, route) => {\n const previous = cache.current.get(route);\n\n if (previous) {\n // If a cached route object already exists, reuse it\n acc.set(route, previous);\n } else {\n const { state, ...proxy } = route;\n\n Object.defineProperty(proxy, CHILD_STATE, {\n enumerable: false,\n value: state,\n });\n\n acc.set(route, proxy);\n }\n\n return acc;\n }, new Map() as RouteCache);\n\n return Array.from(cache.current.values());\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ const MISSING_CONTEXT_ERROR = "Couldn't find a schedule context.";
3
+ export const ScheduleUpdateContext = /*#__PURE__*/React.createContext({
4
+ scheduleUpdate() {
5
+ throw new Error(MISSING_CONTEXT_ERROR);
6
+ },
7
+
8
+ flushUpdates() {
9
+ throw new Error(MISSING_CONTEXT_ERROR);
10
+ }
11
+
12
+ });
13
+ /**
14
+ * When screen config changes, we want to update the navigator in the same update phase.
15
+ * However, navigation state is in the root component and React won't let us update it from a child.
16
+ * This is a workaround for that, the scheduled update is stored in the ref without actually calling setState.
17
+ * It lets all subsequent updates access the latest state so it stays correct.
18
+ * Then we call setState during after the component updates.
19
+ */
20
+
21
+ export default function useScheduleUpdate(callback) {
22
+ const {
23
+ scheduleUpdate,
24
+ flushUpdates
25
+ } = React.useContext(ScheduleUpdateContext);
26
+ scheduleUpdate(callback);
27
+ React.useEffect(flushUpdates);
28
+ }
29
+ //# sourceMappingURL=useScheduleUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useScheduleUpdate.tsx"],"names":["React","MISSING_CONTEXT_ERROR","ScheduleUpdateContext","createContext","scheduleUpdate","Error","flushUpdates","useScheduleUpdate","callback","useContext","useEffect"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,MAAMC,qBAAqB,GAAG,mCAA9B;AAEA,OAAO,MAAMC,qBAAqB,gBAAGF,KAAK,CAACG,aAAN,CAGlC;AACDC,EAAAA,cAAc,GAAG;AACf,UAAM,IAAIC,KAAJ,CAAUJ,qBAAV,CAAN;AACD,GAHA;;AAIDK,EAAAA,YAAY,GAAG;AACb,UAAM,IAAID,KAAJ,CAAUJ,qBAAV,CAAN;AACD;;AANA,CAHkC,CAA9B;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASM,iBAAT,CAA2BC,QAA3B,EAAiD;AAC9D,QAAM;AAAEJ,IAAAA,cAAF;AAAkBE,IAAAA;AAAlB,MAAmCN,KAAK,CAACS,UAAN,CACvCP,qBADuC,CAAzC;AAIAE,EAAAA,cAAc,CAACI,QAAD,CAAd;AAEAR,EAAAA,KAAK,CAACU,SAAN,CAAgBJ,YAAhB;AACD","sourcesContent":["import * as React from 'react';\n\nconst MISSING_CONTEXT_ERROR = \"Couldn't find a schedule context.\";\n\nexport const ScheduleUpdateContext = React.createContext<{\n scheduleUpdate: (callback: () => void) => void;\n flushUpdates: () => void;\n}>({\n scheduleUpdate() {\n throw new Error(MISSING_CONTEXT_ERROR);\n },\n flushUpdates() {\n throw new Error(MISSING_CONTEXT_ERROR);\n },\n});\n\n/**\n * When screen config changes, we want to update the navigator in the same update phase.\n * However, navigation state is in the root component and React won't let us update it from a child.\n * This is a workaround for that, the scheduled update is stored in the ref without actually calling setState.\n * It lets all subsequent updates access the latest state so it stays correct.\n * Then we call setState during after the component updates.\n */\nexport default function useScheduleUpdate(callback: () => void) {\n const { scheduleUpdate, flushUpdates } = React.useContext(\n ScheduleUpdateContext\n );\n\n scheduleUpdate(callback);\n\n React.useEffect(flushUpdates);\n}\n"]}
@@ -0,0 +1,64 @@
1
+ import * as React from 'react';
2
+ const UNINTIALIZED_STATE = {};
3
+ /**
4
+ * This is definitely not compatible with concurrent mode, but we don't have a solution for sync state yet.
5
+ */
6
+
7
+ export default function useSyncState(initialState) {
8
+ const stateRef = React.useRef(UNINTIALIZED_STATE);
9
+ const isSchedulingRef = React.useRef(false);
10
+ const isMountedRef = React.useRef(true);
11
+ React.useEffect(() => {
12
+ isMountedRef.current = true;
13
+ return () => {
14
+ isMountedRef.current = false;
15
+ };
16
+ }, []);
17
+
18
+ if (stateRef.current === UNINTIALIZED_STATE) {
19
+ stateRef.current = // @ts-expect-error: initialState is a function, but TypeScript doesn't think so
20
+ typeof initialState === 'function' ? initialState() : initialState;
21
+ }
22
+
23
+ const [trackingState, setTrackingState] = React.useState(stateRef.current);
24
+ const getState = React.useCallback(() => stateRef.current, []);
25
+ const setState = React.useCallback(state => {
26
+ if (state === stateRef.current || !isMountedRef.current) {
27
+ return;
28
+ }
29
+
30
+ stateRef.current = state;
31
+
32
+ if (!isSchedulingRef.current) {
33
+ setTrackingState(state);
34
+ }
35
+ }, []);
36
+ const scheduleUpdate = React.useCallback(callback => {
37
+ isSchedulingRef.current = true;
38
+
39
+ try {
40
+ callback();
41
+ } finally {
42
+ isSchedulingRef.current = false;
43
+ }
44
+ }, []);
45
+ const flushUpdates = React.useCallback(() => {
46
+ if (!isMountedRef.current) {
47
+ return;
48
+ } // Make sure that the tracking state is up-to-date.
49
+ // We call it unconditionally, but React should skip the update if state is unchanged.
50
+
51
+
52
+ setTrackingState(stateRef.current);
53
+ }, []); // If we're rendering and the tracking state is out of date, update it immediately
54
+ // This will make sure that our updates are applied as early as possible.
55
+
56
+ if (trackingState !== stateRef.current) {
57
+ setTrackingState(stateRef.current);
58
+ }
59
+
60
+ const state = stateRef.current;
61
+ React.useDebugValue(state);
62
+ return [state, getState, setState, scheduleUpdate, flushUpdates];
63
+ }
64
+ //# sourceMappingURL=useSyncState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useSyncState.tsx"],"names":["React","UNINTIALIZED_STATE","useSyncState","initialState","stateRef","useRef","isSchedulingRef","isMountedRef","useEffect","current","trackingState","setTrackingState","useState","getState","useCallback","setState","state","scheduleUpdate","callback","flushUpdates","useDebugValue"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,MAAMC,kBAAkB,GAAG,EAA3B;AAEA;AACA;AACA;;AACA,eAAe,SAASC,YAAT,CAAyBC,YAAzB,EAAuD;AACpE,QAAMC,QAAQ,GAAGJ,KAAK,CAACK,MAAN,CAAgBJ,kBAAhB,CAAjB;AACA,QAAMK,eAAe,GAAGN,KAAK,CAACK,MAAN,CAAa,KAAb,CAAxB;AACA,QAAME,YAAY,GAAGP,KAAK,CAACK,MAAN,CAAa,IAAb,CAArB;AAEAL,EAAAA,KAAK,CAACQ,SAAN,CAAgB,MAAM;AACpBD,IAAAA,YAAY,CAACE,OAAb,GAAuB,IAAvB;AAEA,WAAO,MAAM;AACXF,MAAAA,YAAY,CAACE,OAAb,GAAuB,KAAvB;AACD,KAFD;AAGD,GAND,EAMG,EANH;;AAQA,MAAIL,QAAQ,CAACK,OAAT,KAAqBR,kBAAzB,EAA6C;AAC3CG,IAAAA,QAAQ,CAACK,OAAT,GACE;AACA,WAAON,YAAP,KAAwB,UAAxB,GAAqCA,YAAY,EAAjD,GAAsDA,YAFxD;AAGD;;AAED,QAAM,CAACO,aAAD,EAAgBC,gBAAhB,IAAoCX,KAAK,CAACY,QAAN,CAAeR,QAAQ,CAACK,OAAxB,CAA1C;AAEA,QAAMI,QAAQ,GAAGb,KAAK,CAACc,WAAN,CAAkB,MAAMV,QAAQ,CAACK,OAAjC,EAA0C,EAA1C,CAAjB;AAEA,QAAMM,QAAQ,GAAGf,KAAK,CAACc,WAAN,CAAmBE,KAAD,IAAc;AAC/C,QAAIA,KAAK,KAAKZ,QAAQ,CAACK,OAAnB,IAA8B,CAACF,YAAY,CAACE,OAAhD,EAAyD;AACvD;AACD;;AAEDL,IAAAA,QAAQ,CAACK,OAAT,GAAmBO,KAAnB;;AAEA,QAAI,CAACV,eAAe,CAACG,OAArB,EAA8B;AAC5BE,MAAAA,gBAAgB,CAACK,KAAD,CAAhB;AACD;AACF,GAVgB,EAUd,EAVc,CAAjB;AAYA,QAAMC,cAAc,GAAGjB,KAAK,CAACc,WAAN,CAAmBI,QAAD,IAA0B;AACjEZ,IAAAA,eAAe,CAACG,OAAhB,GAA0B,IAA1B;;AAEA,QAAI;AACFS,MAAAA,QAAQ;AACT,KAFD,SAEU;AACRZ,MAAAA,eAAe,CAACG,OAAhB,GAA0B,KAA1B;AACD;AACF,GARsB,EAQpB,EARoB,CAAvB;AAUA,QAAMU,YAAY,GAAGnB,KAAK,CAACc,WAAN,CAAkB,MAAM;AAC3C,QAAI,CAACP,YAAY,CAACE,OAAlB,EAA2B;AACzB;AACD,KAH0C,CAK3C;AACA;;;AACAE,IAAAA,gBAAgB,CAACP,QAAQ,CAACK,OAAV,CAAhB;AACD,GARoB,EAQlB,EARkB,CAArB,CA7CoE,CAuDpE;AACA;;AACA,MAAIC,aAAa,KAAKN,QAAQ,CAACK,OAA/B,EAAwC;AACtCE,IAAAA,gBAAgB,CAACP,QAAQ,CAACK,OAAV,CAAhB;AACD;;AAED,QAAMO,KAAK,GAAGZ,QAAQ,CAACK,OAAvB;AAEAT,EAAAA,KAAK,CAACoB,aAAN,CAAoBJ,KAApB;AAEA,SAAO,CAACA,KAAD,EAAQH,QAAR,EAAkBE,QAAlB,EAA4BE,cAA5B,EAA4CE,YAA5C,CAAP;AACD","sourcesContent":["import * as React from 'react';\n\nconst UNINTIALIZED_STATE = {};\n\n/**\n * This is definitely not compatible with concurrent mode, but we don't have a solution for sync state yet.\n */\nexport default function useSyncState<T>(initialState?: (() => T) | T) {\n const stateRef = React.useRef<T>(UNINTIALIZED_STATE as any);\n const isSchedulingRef = React.useRef(false);\n const isMountedRef = React.useRef(true);\n\n React.useEffect(() => {\n isMountedRef.current = true;\n\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n\n if (stateRef.current === UNINTIALIZED_STATE) {\n stateRef.current =\n // @ts-expect-error: initialState is a function, but TypeScript doesn't think so\n typeof initialState === 'function' ? initialState() : initialState;\n }\n\n const [trackingState, setTrackingState] = React.useState(stateRef.current);\n\n const getState = React.useCallback(() => stateRef.current, []);\n\n const setState = React.useCallback((state: T) => {\n if (state === stateRef.current || !isMountedRef.current) {\n return;\n }\n\n stateRef.current = state;\n\n if (!isSchedulingRef.current) {\n setTrackingState(state);\n }\n }, []);\n\n const scheduleUpdate = React.useCallback((callback: () => void) => {\n isSchedulingRef.current = true;\n\n try {\n callback();\n } finally {\n isSchedulingRef.current = false;\n }\n }, []);\n\n const flushUpdates = React.useCallback(() => {\n if (!isMountedRef.current) {\n return;\n }\n\n // Make sure that the tracking state is up-to-date.\n // We call it unconditionally, but React should skip the update if state is unchanged.\n setTrackingState(stateRef.current);\n }, []);\n\n // If we're rendering and the tracking state is out of date, update it immediately\n // This will make sure that our updates are applied as early as possible.\n if (trackingState !== stateRef.current) {\n setTrackingState(stateRef.current);\n }\n\n const state = stateRef.current;\n\n React.useDebugValue(state);\n\n return [state, getState, setState, scheduleUpdate, flushUpdates] as const;\n}\n"]}
@@ -0,0 +1,24 @@
1
+ const formatToList = items => items.map(key => `- ${key}`).join('\n');
2
+
3
+ export default function validatePathConfig(config, root = true) {
4
+ const validKeys = ['initialRouteName', 'screens'];
5
+
6
+ if (!root) {
7
+ validKeys.push('path', 'exact', 'stringify', 'parse');
8
+ }
9
+
10
+ const invalidKeys = Object.keys(config).filter(key => !validKeys.includes(key));
11
+
12
+ if (invalidKeys.length) {
13
+ throw new Error(`Found invalid properties in the configuration:\n${formatToList(invalidKeys)}\n\nDid you forget to specify them under a 'screens' property?\n\nYou can only specify the following properties:\n${formatToList(validKeys)}\n\nSee https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.`);
14
+ }
15
+
16
+ if (config.screens) {
17
+ Object.entries(config.screens).forEach(([_, value]) => {
18
+ if (typeof value !== 'string') {
19
+ validatePathConfig(value, false);
20
+ }
21
+ });
22
+ }
23
+ }
24
+ //# sourceMappingURL=validatePathConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["validatePathConfig.tsx"],"names":["formatToList","items","map","key","join","validatePathConfig","config","root","validKeys","push","invalidKeys","Object","keys","filter","includes","length","Error","screens","entries","forEach","_","value"],"mappings":"AAAA,MAAMA,YAAY,GAAIC,KAAD,IACnBA,KAAK,CAACC,GAAN,CAAWC,GAAD,IAAU,KAAIA,GAAI,EAA5B,EAA+BC,IAA/B,CAAoC,IAApC,CADF;;AAGA,eAAe,SAASC,kBAAT,CAA4BC,MAA5B,EAAyCC,IAAI,GAAG,IAAhD,EAAsD;AACnE,QAAMC,SAAS,GAAG,CAAC,kBAAD,EAAqB,SAArB,CAAlB;;AAEA,MAAI,CAACD,IAAL,EAAW;AACTC,IAAAA,SAAS,CAACC,IAAV,CAAe,MAAf,EAAuB,OAAvB,EAAgC,WAAhC,EAA6C,OAA7C;AACD;;AAED,QAAMC,WAAW,GAAGC,MAAM,CAACC,IAAP,CAAYN,MAAZ,EAAoBO,MAApB,CACjBV,GAAD,IAAS,CAACK,SAAS,CAACM,QAAV,CAAmBX,GAAnB,CADQ,CAApB;;AAIA,MAAIO,WAAW,CAACK,MAAhB,EAAwB;AACtB,UAAM,IAAIC,KAAJ,CACH,mDAAkDhB,YAAY,CAC7DU,WAD6D,CAE7D,qHAAoHV,YAAY,CAChIQ,SADgI,CAEhI,wHALE,CAAN;AAOD;;AAED,MAAIF,MAAM,CAACW,OAAX,EAAoB;AAClBN,IAAAA,MAAM,CAACO,OAAP,CAAeZ,MAAM,CAACW,OAAtB,EAA+BE,OAA/B,CAAuC,CAAC,CAACC,CAAD,EAAIC,KAAJ,CAAD,KAAgB;AACrD,UAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC7BhB,QAAAA,kBAAkB,CAACgB,KAAD,EAAQ,KAAR,CAAlB;AACD;AACF,KAJD;AAKD;AACF","sourcesContent":["const formatToList = (items: string[]) =>\n items.map((key) => `- ${key}`).join('\\n');\n\nexport default function validatePathConfig(config: any, root = true) {\n const validKeys = ['initialRouteName', 'screens'];\n\n if (!root) {\n validKeys.push('path', 'exact', 'stringify', 'parse');\n }\n\n const invalidKeys = Object.keys(config).filter(\n (key) => !validKeys.includes(key)\n );\n\n if (invalidKeys.length) {\n throw new Error(\n `Found invalid properties in the configuration:\\n${formatToList(\n invalidKeys\n )}\\n\\nDid you forget to specify them under a 'screens' property?\\n\\nYou can only specify the following properties:\\n${formatToList(\n validKeys\n )}\\n\\nSee https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.`\n );\n }\n\n if (config.screens) {\n Object.entries(config.screens).forEach(([_, value]) => {\n if (typeof value !== 'string') {\n validatePathConfig(value, false);\n }\n });\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { ParamListBase } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ import type { NavigationContainerProps, NavigationContainerRef } from './types';
4
+ /**
5
+ * Container component which holds the navigation state.
6
+ * This should be rendered at the root wrapping the whole app.
7
+ *
8
+ * @param props.initialState Initial state object for the navigation tree.
9
+ * @param props.onStateChange Callback which is called with the latest navigation state when it changes.
10
+ * @param props.children Child elements to render the content.
11
+ * @param props.ref Ref object which refers to the navigation object containing helper methods.
12
+ */
13
+ declare const BaseNavigationContainer: React.ForwardRefExoticComponent<NavigationContainerProps & React.RefAttributes<NavigationContainerRef<ParamListBase>>>;
14
+ export default BaseNavigationContainer;
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Context which holds the values for the current navigation tree.
4
+ * Intended for use in SSR. This is not safe to use on the client.
5
+ */
6
+ declare const CurrentRenderContext: React.Context<{
7
+ options?: object | undefined;
8
+ } | undefined>;
9
+ export default CurrentRenderContext;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ declare type Props = {
3
+ children: React.ReactNode;
4
+ };
5
+ export declare const SingleNavigatorContext: React.Context<{
6
+ register(key: string): void;
7
+ unregister(key: string): void;
8
+ } | undefined>;
9
+ /**
10
+ * Component which ensures that there's only one navigator nested under it.
11
+ */
12
+ export default function EnsureSingleNavigator({ children }: Props): JSX.Element;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { ParamListBase } from '@react-navigation/routers';
2
+ import type { RouteGroupConfig } from './types';
3
+ /**
4
+ * Empty component used for grouping screen configs.
5
+ */
6
+ export default function Group<ParamList extends ParamListBase, ScreenOptions extends {}>(_: RouteGroupConfig<ParamList, ScreenOptions>): null;
@@ -0,0 +1,34 @@
1
+ import type { NavigationAction, NavigationState, ParamListBase } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ import type { NavigationHelpers } from './types';
4
+ export declare type ListenerMap = {
5
+ action: ChildActionListener;
6
+ focus: FocusedNavigationListener;
7
+ };
8
+ export declare type KeyedListenerMap = {
9
+ getState: GetStateListener;
10
+ beforeRemove: ChildBeforeRemoveListener;
11
+ };
12
+ export declare type AddListener = <T extends keyof ListenerMap>(type: T, listener: ListenerMap[T]) => void;
13
+ export declare type AddKeyedListener = <T extends keyof KeyedListenerMap>(type: T, key: string, listener: KeyedListenerMap[T]) => void;
14
+ export declare type ChildActionListener = (action: NavigationAction, visitedNavigators?: Set<string>) => boolean;
15
+ export declare type FocusedNavigationCallback<T> = (navigation: NavigationHelpers<ParamListBase>) => T;
16
+ export declare type FocusedNavigationListener = <T>(callback: FocusedNavigationCallback<T>) => {
17
+ handled: boolean;
18
+ result: T;
19
+ };
20
+ export declare type GetStateListener = () => NavigationState;
21
+ export declare type ChildBeforeRemoveListener = (action: NavigationAction) => boolean;
22
+ /**
23
+ * Context which holds the required helpers needed to build nested navigators.
24
+ */
25
+ declare const NavigationBuilderContext: React.Context<{
26
+ onAction?: ((action: NavigationAction, visitedNavigators?: Set<string> | undefined) => boolean) | undefined;
27
+ addListener?: AddListener | undefined;
28
+ addKeyedListener?: AddKeyedListener | undefined;
29
+ onRouteFocus?: ((key: string) => void) | undefined;
30
+ onDispatchAction: (action: NavigationAction, noop: boolean) => void;
31
+ onOptionsChange: (options: object) => void;
32
+ stackRef?: React.MutableRefObject<string | undefined> | undefined;
33
+ }>;
34
+ export default NavigationBuilderContext;
@@ -0,0 +1,8 @@
1
+ import type { ParamListBase } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ import type { NavigationContainerRef } from './types';
4
+ /**
5
+ * Context which holds the route prop for a screen.
6
+ */
7
+ declare const NavigationContainerRefContext: React.Context<NavigationContainerRef<ParamListBase> | undefined>;
8
+ export default NavigationContainerRefContext;
@@ -0,0 +1,24 @@
1
+ import type { ParamListBase } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ import type { NavigationProp } from './types';
4
+ /**
5
+ * Context which holds the navigation prop for a screen.
6
+ */
7
+ declare const NavigationContext: React.Context<NavigationProp<ParamListBase, string, Readonly<{
8
+ key: string;
9
+ index: number;
10
+ routeNames: string[];
11
+ history?: unknown[] | undefined;
12
+ routes: (Readonly<{
13
+ key: string;
14
+ name: string;
15
+ path?: string | undefined;
16
+ }> & Readonly<{
17
+ params?: Readonly<object | undefined>;
18
+ }> & {
19
+ state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
20
+ })[];
21
+ type: string;
22
+ stale: false;
23
+ }>, {}, {}> | undefined>;
24
+ export default NavigationContext;
@@ -0,0 +1,9 @@
1
+ import type { ParamListBase } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ import type { NavigationHelpers } from './types';
4
+ /**
5
+ * Context which holds the navigation helpers of the parent navigator.
6
+ * Navigators should use this context in their view component.
7
+ */
8
+ declare const NavigationHelpersContext: React.Context<NavigationHelpers<ParamListBase, {}> | undefined>;
9
+ export default NavigationHelpersContext;
@@ -0,0 +1,7 @@
1
+ import type { Route } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ /**
4
+ * Context which holds the route prop for a screen.
5
+ */
6
+ declare const NavigationRouteContext: React.Context<Route<string, object | undefined> | undefined>;
7
+ export default NavigationRouteContext;
@@ -0,0 +1,45 @@
1
+ import type { NavigationState, PartialState } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ declare const _default: React.Context<{
4
+ isDefault?: true | undefined;
5
+ state?: Readonly<{
6
+ key: string;
7
+ index: number;
8
+ routeNames: string[];
9
+ history?: unknown[] | undefined;
10
+ routes: (Readonly<{
11
+ key: string;
12
+ name: string;
13
+ path?: string | undefined;
14
+ }> & Readonly<{
15
+ params?: Readonly<object | undefined>;
16
+ }> & {
17
+ state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
18
+ })[];
19
+ type: string;
20
+ stale: false;
21
+ }> | PartialState<Readonly<{
22
+ key: string;
23
+ index: number;
24
+ routeNames: string[];
25
+ history?: unknown[] | undefined;
26
+ routes: (Readonly<{
27
+ key: string;
28
+ name: string;
29
+ path?: string | undefined;
30
+ }> & Readonly<{
31
+ params?: Readonly<object | undefined>;
32
+ }> & {
33
+ state?: Readonly<any> | PartialState<Readonly<any>> | undefined;
34
+ })[];
35
+ type: string;
36
+ stale: false;
37
+ }>> | undefined;
38
+ getKey: () => string | undefined;
39
+ setKey: (key: string) => void;
40
+ getState: () => NavigationState | PartialState<NavigationState> | undefined;
41
+ setState: (state: NavigationState | PartialState<NavigationState> | undefined) => void;
42
+ getIsInitial: () => boolean;
43
+ addOptionsGetter?: ((key: string, getter: () => object | undefined | null) => void) | undefined;
44
+ }>;
45
+ export default _default;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import type { NavigationState, ParamListBase, PartialState, Route } from '@react-navigation/routers';
3
+ import type { NavigationProp, RouteConfigComponent } from './types';
4
+ declare type Props<State extends NavigationState, ScreenOptions extends {}> = {
5
+ screen: RouteConfigComponent<ParamListBase, string> & {
6
+ name: string;
7
+ };
8
+ navigation: NavigationProp<ParamListBase, string, State, ScreenOptions>;
9
+ route: Route<string>;
10
+ routeState: NavigationState | PartialState<NavigationState> | undefined;
11
+ getState: () => State;
12
+ setState: (state: State) => void;
13
+ options: object;
14
+ clearOptions: () => void;
15
+ };
16
+ /**
17
+ * Component which takes care of rendering the screen for a route.
18
+ * It provides all required contexts and applies optimizations when applicable.
19
+ */
20
+ export default function SceneView<State extends NavigationState, ScreenOptions extends {}>({ screen, route, navigation, routeState, getState, setState, options, clearOptions, }: Props<State, ScreenOptions>): JSX.Element;
21
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { NavigationState, ParamListBase } from '@react-navigation/routers';
2
+ import type { EventMapBase, RouteConfig } from './types';
3
+ /**
4
+ * Empty component used for specifying route configuration.
5
+ */
6
+ export default function Screen<ParamList extends ParamListBase, RouteName extends keyof ParamList, State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase>(_: RouteConfig<ParamList, RouteName, State, ScreenOptions, EventMap>): null;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Component which prevents updates for children if no props changed
4
+ */
5
+ declare function StaticContainer(props: any): any;
6
+ declare const _default: React.MemoExoticComponent<typeof StaticContainer>;
7
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import type { NavigationAction } from '@react-navigation/routers';
2
+ import * as React from 'react';
3
+ declare const UnhandledActionContext: React.Context<((action: NavigationAction) => void) | undefined>;
4
+ export default UnhandledActionContext;
@@ -0,0 +1,2 @@
1
+ import type { NavigationState } from '@react-navigation/routers';
2
+ export default function checkDuplicateRouteNames(state: NavigationState): string[][];
@@ -0,0 +1,9 @@
1
+ export default function checkSerializable(o: {
2
+ [key: string]: any;
3
+ }): {
4
+ serializable: true;
5
+ } | {
6
+ serializable: false;
7
+ location: (string | number)[];
8
+ reason: string;
9
+ };
@@ -0,0 +1,3 @@
1
+ import type { NavigationContainerRefWithCurrent } from './types';
2
+ export declare const NOT_INITIALIZED_ERROR = "The 'navigation' object hasn't been initialized yet. This might happen if you don't have a navigator mounted, or if the navigator hasn't finished mounting. See https://reactnavigation.org/docs/navigating-without-navigation-prop#handling-initialization for more details.";
3
+ export default function createNavigationContainerRef<ParamList extends {} = ReactNavigation.RootParamList>(): NavigationContainerRefWithCurrent<ParamList>;
@@ -0,0 +1,11 @@
1
+ import type { NavigationState, ParamListBase } from '@react-navigation/routers';
2
+ import type * as React from 'react';
3
+ import type { EventMapBase, TypedNavigator } from './types';
4
+ /**
5
+ * Higher order component to create a `Navigator` and `Screen` pair.
6
+ * Custom navigators should wrap the navigator component in `createNavigator` before exporting.
7
+ *
8
+ * @param Navigator The navigtor component to wrap.
9
+ * @returns Factory method to create a `Navigator` and `Screen` pair.
10
+ */
11
+ export default function createNavigatorFactory<State extends NavigationState, ScreenOptions extends {}, EventMap extends EventMapBase, NavigatorComponent extends React.ComponentType<any>>(Navigator: NavigatorComponent): <ParamList extends ParamListBase>() => TypedNavigator<ParamList, State, ScreenOptions, EventMap, NavigatorComponent>;
@@ -0,0 +1,22 @@
1
+ import type { InitialState } from '@react-navigation/routers';
2
+ export default function findFocusedRoute(state: InitialState): (Omit<import("@react-navigation/routers").Route<string, object | undefined>, "key"> & {
3
+ state?: Readonly<Partial<Omit<Readonly<{
4
+ key: string;
5
+ index: number;
6
+ routeNames: string[];
7
+ history?: unknown[] | undefined;
8
+ routes: (Readonly<{
9
+ key: string;
10
+ name: string;
11
+ path?: string | undefined;
12
+ }> & Readonly<{
13
+ params?: Readonly<object | undefined>;
14
+ }> & {
15
+ state?: Readonly<any> | import("@react-navigation/routers").PartialState<Readonly<any>> | undefined;
16
+ })[];
17
+ type: string;
18
+ stale: false;
19
+ }>, "stale" | "routes">> & {
20
+ routes: (Omit<import("@react-navigation/routers").Route<string, object | undefined>, "key"> & any)[];
21
+ }> | undefined;
22
+ }) | undefined;
@@ -0,0 +1 @@
1
+ export default function fromEntries<K extends string, V>(entries: (readonly [K, V])[]): Record<K, V>;
@@ -0,0 +1,16 @@
1
+ import type { CommonActions, NavigationState, PartialState } from '@react-navigation/routers';
2
+ import type { NavigatorScreenParams, PathConfigMap } from './types';
3
+ declare type Options = {
4
+ initialRouteName?: string;
5
+ screens: PathConfigMap<object>;
6
+ };
7
+ declare type NavigateAction<State extends NavigationState> = {
8
+ type: 'NAVIGATE';
9
+ payload: {
10
+ name: string;
11
+ params?: NavigatorScreenParams<State>;
12
+ path?: string;
13
+ };
14
+ };
15
+ export default function getActionFromState(state: PartialState<NavigationState>, options?: Options): NavigateAction<NavigationState> | CommonActions.Action | undefined;
16
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { Route } from '@react-navigation/routers';
2
+ export default function getFocusedRouteNameFromRoute(route: Partial<Route<string>>): string | undefined;
@@ -0,0 +1,38 @@
1
+ import type { NavigationState, PartialState } from '@react-navigation/routers';
2
+ import type { PathConfigMap } from './types';
3
+ declare type Options<ParamList> = {
4
+ initialRouteName?: string;
5
+ screens: PathConfigMap<ParamList>;
6
+ };
7
+ declare type State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;
8
+ /**
9
+ * Utility to serialize a navigation state object to a path string.
10
+ *
11
+ * @example
12
+ * ```js
13
+ * getPathFromState(
14
+ * {
15
+ * routes: [
16
+ * {
17
+ * name: 'Chat',
18
+ * params: { author: 'Jane', id: 42 },
19
+ * },
20
+ * ],
21
+ * },
22
+ * {
23
+ * screens: {
24
+ * Chat: {
25
+ * path: 'chat/:author/:id',
26
+ * stringify: { author: author => author.toLowerCase() }
27
+ * }
28
+ * }
29
+ * }
30
+ * )
31
+ * ```
32
+ *
33
+ * @param state Navigation state to serialize.
34
+ * @param options Extra options to fine-tune how to serialize the path.
35
+ * @returns Path representing the state, e.g. /foo/bar?count=42.
36
+ */
37
+ export default function getPathFromState<ParamList extends {}>(state: State, options?: Options<ParamList>): string;
38
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { NavigationState, PartialState } from '@react-navigation/routers';
2
+ import type { PathConfigMap } from './types';
3
+ declare type Options<ParamList extends {}> = {
4
+ initialRouteName?: string;
5
+ screens: PathConfigMap<ParamList>;
6
+ };
7
+ declare type ResultState = PartialState<NavigationState> & {
8
+ state?: ResultState;
9
+ };
10
+ /**
11
+ * Utility to parse a path string to initial state object accepted by the container.
12
+ * This is useful for deep linking when we need to handle the incoming URL.
13
+ *
14
+ * @example
15
+ * ```js
16
+ * getStateFromPath(
17
+ * '/chat/jane/42',
18
+ * {
19
+ * screens: {
20
+ * Chat: {
21
+ * path: 'chat/:author/:id',
22
+ * parse: { id: Number }
23
+ * }
24
+ * }
25
+ * }
26
+ * )
27
+ * ```
28
+ * @param path Path string to parse and convert, e.g. /foo/bar?count=42.
29
+ * @param options Extra options to fine-tune how to parse the path.
30
+ */
31
+ export default function getStateFromPath<ParamList extends {}>(path: string, options?: Options<ParamList>): ResultState | undefined;
32
+ export {};
@@ -0,0 +1,23 @@
1
+ export { default as BaseNavigationContainer } from './BaseNavigationContainer';
2
+ export { default as createNavigationContainerRef } from './createNavigationContainerRef';
3
+ export { default as createNavigatorFactory } from './createNavigatorFactory';
4
+ export { default as CurrentRenderContext } from './CurrentRenderContext';
5
+ export { default as findFocusedRoute } from './findFocusedRoute';
6
+ export { default as getActionFromState } from './getActionFromState';
7
+ export { default as getFocusedRouteNameFromRoute } from './getFocusedRouteNameFromRoute';
8
+ export { default as getPathFromState } from './getPathFromState';
9
+ export { default as getStateFromPath } from './getStateFromPath';
10
+ export { default as NavigationContainerRefContext } from './NavigationContainerRefContext';
11
+ export { default as NavigationContext } from './NavigationContext';
12
+ export { default as NavigationHelpersContext } from './NavigationHelpersContext';
13
+ export { default as NavigationRouteContext } from './NavigationRouteContext';
14
+ export * from './types';
15
+ export { default as useFocusEffect } from './useFocusEffect';
16
+ export { default as useIsFocused } from './useIsFocused';
17
+ export { default as useNavigation } from './useNavigation';
18
+ export { default as useNavigationBuilder } from './useNavigationBuilder';
19
+ export { default as useNavigationContainerRef } from './useNavigationContainerRef';
20
+ export { default as useNavigationState } from './useNavigationState';
21
+ export { default as useRoute } from './useRoute';
22
+ export { default as validatePathConfig } from './validatePathConfig';
23
+ export * from '@react-navigation/routers';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Compare two arrays with primitive values as the content.
3
+ * We need to make sure that both values and order match.
4
+ */
5
+ export default function isArrayEqual(a: any[], b: any[]): boolean;