@react-navigation/core 7.0.0-alpha.3 → 7.0.0-alpha.5

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 (298) hide show
  1. package/lib/commonjs/BaseNavigationContainer.js +16 -29
  2. package/lib/commonjs/BaseNavigationContainer.js.map +1 -1
  3. package/lib/commonjs/CurrentRenderContext.js +3 -4
  4. package/lib/commonjs/CurrentRenderContext.js.map +1 -1
  5. package/lib/commonjs/DeprecatedNavigationInChildContext.js +3 -4
  6. package/lib/commonjs/DeprecatedNavigationInChildContext.js.map +1 -1
  7. package/lib/commonjs/EnsureSingleNavigator.js +3 -4
  8. package/lib/commonjs/EnsureSingleNavigator.js.map +1 -1
  9. package/lib/commonjs/Group.js.map +1 -1
  10. package/lib/commonjs/NavigationBuilderContext.js +3 -4
  11. package/lib/commonjs/NavigationBuilderContext.js.map +1 -1
  12. package/lib/commonjs/NavigationContainerRefContext.js +3 -4
  13. package/lib/commonjs/NavigationContainerRefContext.js.map +1 -1
  14. package/lib/commonjs/NavigationContext.js +3 -4
  15. package/lib/commonjs/NavigationContext.js.map +1 -1
  16. package/lib/commonjs/NavigationHelpersContext.js +3 -4
  17. package/lib/commonjs/NavigationHelpersContext.js.map +1 -1
  18. package/lib/commonjs/NavigationIndependentTree.js +2 -2
  19. package/lib/commonjs/NavigationIndependentTree.js.map +1 -1
  20. package/lib/commonjs/NavigationIndependentTreeContext.js +3 -4
  21. package/lib/commonjs/NavigationIndependentTreeContext.js.map +1 -1
  22. package/lib/commonjs/NavigationRouteContext.js +3 -4
  23. package/lib/commonjs/NavigationRouteContext.js.map +1 -1
  24. package/lib/commonjs/NavigationStateContext.js +3 -4
  25. package/lib/commonjs/NavigationStateContext.js.map +1 -1
  26. package/lib/commonjs/PreventRemoveContext.js +8 -4
  27. package/lib/commonjs/PreventRemoveContext.js.map +1 -1
  28. package/lib/commonjs/PreventRemoveProvider.js +8 -10
  29. package/lib/commonjs/PreventRemoveProvider.js.map +1 -1
  30. package/lib/commonjs/SceneView.js +2 -2
  31. package/lib/commonjs/SceneView.js.map +1 -1
  32. package/lib/commonjs/Screen.js.map +1 -1
  33. package/lib/commonjs/StaticContainer.js +3 -4
  34. package/lib/commonjs/StaticContainer.js.map +1 -1
  35. package/lib/commonjs/StaticNavigation.js +27 -3
  36. package/lib/commonjs/StaticNavigation.js.map +1 -1
  37. package/lib/commonjs/UnhandledActionContext.js +3 -4
  38. package/lib/commonjs/UnhandledActionContext.js.map +1 -1
  39. package/lib/commonjs/checkDuplicateRouteNames.js +1 -2
  40. package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -1
  41. package/lib/commonjs/checkSerializable.js.map +1 -1
  42. package/lib/commonjs/createNavigationContainerRef.js +1 -2
  43. package/lib/commonjs/createNavigationContainerRef.js.map +1 -1
  44. package/lib/commonjs/createNavigatorFactory.js +0 -3
  45. package/lib/commonjs/createNavigatorFactory.js.map +1 -1
  46. package/lib/commonjs/findFocusedRoute.js +2 -4
  47. package/lib/commonjs/findFocusedRoute.js.map +1 -1
  48. package/lib/commonjs/getActionFromState.js +6 -8
  49. package/lib/commonjs/getActionFromState.js.map +1 -1
  50. package/lib/commonjs/getFocusedRouteNameFromRoute.js +1 -1
  51. package/lib/commonjs/getFocusedRouteNameFromRoute.js.map +1 -1
  52. package/lib/commonjs/getPathFromState.js +15 -19
  53. package/lib/commonjs/getPathFromState.js.map +1 -1
  54. package/lib/commonjs/getStateFromPath.js +11 -19
  55. package/lib/commonjs/getStateFromPath.js.map +1 -1
  56. package/lib/commonjs/index.js.map +1 -1
  57. package/lib/commonjs/isArrayEqual.js.map +1 -1
  58. package/lib/commonjs/isRecordEqual.js.map +1 -1
  59. package/lib/commonjs/types.js.map +1 -1
  60. package/lib/commonjs/useChildListeners.js +2 -2
  61. package/lib/commonjs/useChildListeners.js.map +1 -1
  62. package/lib/commonjs/useComponent.js +2 -2
  63. package/lib/commonjs/useComponent.js.map +1 -1
  64. package/lib/commonjs/useCurrentRender.js +2 -2
  65. package/lib/commonjs/useCurrentRender.js.map +1 -1
  66. package/lib/commonjs/useDescriptors.js +4 -15
  67. package/lib/commonjs/useDescriptors.js.map +1 -1
  68. package/lib/commonjs/useEventEmitter.js +5 -6
  69. package/lib/commonjs/useEventEmitter.js.map +1 -1
  70. package/lib/commonjs/useFocusEffect.js +4 -2
  71. package/lib/commonjs/useFocusEffect.js.map +1 -1
  72. package/lib/commonjs/useFocusEvents.js +4 -4
  73. package/lib/commonjs/useFocusEvents.js.map +1 -1
  74. package/lib/commonjs/useFocusedListenersChildrenAdapter.js +3 -3
  75. package/lib/commonjs/useFocusedListenersChildrenAdapter.js.map +1 -1
  76. package/lib/commonjs/useIsFocused.js +5 -4
  77. package/lib/commonjs/useIsFocused.js.map +1 -1
  78. package/lib/commonjs/useIsomorphicLayoutEffect.js +12 -0
  79. package/lib/commonjs/useIsomorphicLayoutEffect.js.map +1 -0
  80. package/lib/commonjs/useIsomorphicLayoutEffect.native.js +9 -0
  81. package/lib/commonjs/useIsomorphicLayoutEffect.native.js.map +1 -0
  82. package/lib/commonjs/useKeyedChildListeners.js +2 -2
  83. package/lib/commonjs/useKeyedChildListeners.js.map +1 -1
  84. package/lib/commonjs/useNavigation.js +2 -2
  85. package/lib/commonjs/useNavigation.js.map +1 -1
  86. package/lib/commonjs/useNavigationBuilder.js +68 -65
  87. package/lib/commonjs/useNavigationBuilder.js.map +1 -1
  88. package/lib/commonjs/useNavigationCache.js +2 -2
  89. package/lib/commonjs/useNavigationCache.js.map +1 -1
  90. package/lib/commonjs/useNavigationContainerRef.js +2 -2
  91. package/lib/commonjs/useNavigationContainerRef.js.map +1 -1
  92. package/lib/commonjs/useNavigationHelpers.js +4 -5
  93. package/lib/commonjs/useNavigationHelpers.js.map +1 -1
  94. package/lib/commonjs/useNavigationIndependentTree.js +2 -2
  95. package/lib/commonjs/useNavigationIndependentTree.js.map +1 -1
  96. package/lib/commonjs/useNavigationState.js +2 -2
  97. package/lib/commonjs/useNavigationState.js.map +1 -1
  98. package/lib/commonjs/useOnAction.js +3 -3
  99. package/lib/commonjs/useOnAction.js.map +1 -1
  100. package/lib/commonjs/useOnGetState.js +4 -5
  101. package/lib/commonjs/useOnGetState.js.map +1 -1
  102. package/lib/commonjs/useOnPreventRemove.js +5 -6
  103. package/lib/commonjs/useOnPreventRemove.js.map +1 -1
  104. package/lib/commonjs/useOnRouteFocus.js +2 -2
  105. package/lib/commonjs/useOnRouteFocus.js.map +1 -1
  106. package/lib/commonjs/useOptionsGetters.js +9 -10
  107. package/lib/commonjs/useOptionsGetters.js.map +1 -1
  108. package/lib/commonjs/usePreventRemove.js +3 -3
  109. package/lib/commonjs/usePreventRemove.js.map +1 -1
  110. package/lib/commonjs/usePreventRemoveContext.js +2 -2
  111. package/lib/commonjs/usePreventRemoveContext.js.map +1 -1
  112. package/lib/commonjs/useRegisterNavigator.js +2 -2
  113. package/lib/commonjs/useRegisterNavigator.js.map +1 -1
  114. package/lib/commonjs/useRoute.js +2 -2
  115. package/lib/commonjs/useRoute.js.map +1 -1
  116. package/lib/commonjs/useRouteCache.js +3 -4
  117. package/lib/commonjs/useRouteCache.js.map +1 -1
  118. package/lib/commonjs/useSyncState.js +27 -56
  119. package/lib/commonjs/useSyncState.js.map +1 -1
  120. package/lib/commonjs/validatePathConfig.js.map +1 -1
  121. package/lib/module/BaseNavigationContainer.js +13 -25
  122. package/lib/module/BaseNavigationContainer.js.map +1 -1
  123. package/lib/module/CurrentRenderContext.js.map +1 -1
  124. package/lib/module/DeprecatedNavigationInChildContext.js.map +1 -1
  125. package/lib/module/EnsureSingleNavigator.js.map +1 -1
  126. package/lib/module/Group.js.map +1 -1
  127. package/lib/module/NavigationBuilderContext.js.map +1 -1
  128. package/lib/module/NavigationContainerRefContext.js.map +1 -1
  129. package/lib/module/NavigationContext.js.map +1 -1
  130. package/lib/module/NavigationHelpersContext.js.map +1 -1
  131. package/lib/module/NavigationIndependentTree.js.map +1 -1
  132. package/lib/module/NavigationIndependentTreeContext.js.map +1 -1
  133. package/lib/module/NavigationRouteContext.js.map +1 -1
  134. package/lib/module/NavigationStateContext.js.map +1 -1
  135. package/lib/module/PreventRemoveContext.js.map +1 -1
  136. package/lib/module/PreventRemoveProvider.js +6 -8
  137. package/lib/module/PreventRemoveProvider.js.map +1 -1
  138. package/lib/module/SceneView.js.map +1 -1
  139. package/lib/module/Screen.js.map +1 -1
  140. package/lib/module/StaticContainer.js.map +1 -1
  141. package/lib/module/StaticNavigation.js +20 -1
  142. package/lib/module/StaticNavigation.js.map +1 -1
  143. package/lib/module/UnhandledActionContext.js.map +1 -1
  144. package/lib/module/checkDuplicateRouteNames.js +1 -2
  145. package/lib/module/checkDuplicateRouteNames.js.map +1 -1
  146. package/lib/module/checkSerializable.js.map +1 -1
  147. package/lib/module/createNavigationContainerRef.js.map +1 -1
  148. package/lib/module/createNavigatorFactory.js +0 -3
  149. package/lib/module/createNavigatorFactory.js.map +1 -1
  150. package/lib/module/findFocusedRoute.js +2 -4
  151. package/lib/module/findFocusedRoute.js.map +1 -1
  152. package/lib/module/getActionFromState.js +6 -8
  153. package/lib/module/getActionFromState.js.map +1 -1
  154. package/lib/module/getFocusedRouteNameFromRoute.js +1 -1
  155. package/lib/module/getFocusedRouteNameFromRoute.js.map +1 -1
  156. package/lib/module/getPathFromState.js +13 -17
  157. package/lib/module/getPathFromState.js.map +1 -1
  158. package/lib/module/getStateFromPath.js +9 -17
  159. package/lib/module/getStateFromPath.js.map +1 -1
  160. package/lib/module/index.js.map +1 -1
  161. package/lib/module/isArrayEqual.js.map +1 -1
  162. package/lib/module/isRecordEqual.js.map +1 -1
  163. package/lib/module/types.js.map +1 -1
  164. package/lib/module/useChildListeners.js.map +1 -1
  165. package/lib/module/useComponent.js.map +1 -1
  166. package/lib/module/useCurrentRender.js.map +1 -1
  167. package/lib/module/useDescriptors.js +2 -13
  168. package/lib/module/useDescriptors.js.map +1 -1
  169. package/lib/module/useEventEmitter.js +3 -4
  170. package/lib/module/useEventEmitter.js.map +1 -1
  171. package/lib/module/useFocusEffect.js +2 -0
  172. package/lib/module/useFocusEffect.js.map +1 -1
  173. package/lib/module/useFocusEvents.js +2 -2
  174. package/lib/module/useFocusEvents.js.map +1 -1
  175. package/lib/module/useFocusedListenersChildrenAdapter.js +1 -1
  176. package/lib/module/useFocusedListenersChildrenAdapter.js.map +1 -1
  177. package/lib/module/useIsFocused.js.map +1 -1
  178. package/lib/module/useIsomorphicLayoutEffect.js +7 -0
  179. package/lib/module/useIsomorphicLayoutEffect.js.map +1 -0
  180. package/lib/module/useIsomorphicLayoutEffect.native.js +3 -0
  181. package/lib/module/useIsomorphicLayoutEffect.native.js.map +1 -0
  182. package/lib/module/useKeyedChildListeners.js.map +1 -1
  183. package/lib/module/useNavigation.js.map +1 -1
  184. package/lib/module/useNavigationBuilder.js +65 -63
  185. package/lib/module/useNavigationBuilder.js.map +1 -1
  186. package/lib/module/useNavigationCache.js.map +1 -1
  187. package/lib/module/useNavigationContainerRef.js.map +1 -1
  188. package/lib/module/useNavigationHelpers.js +2 -3
  189. package/lib/module/useNavigationHelpers.js.map +1 -1
  190. package/lib/module/useNavigationIndependentTree.js.map +1 -1
  191. package/lib/module/useNavigationState.js.map +1 -1
  192. package/lib/module/useOnAction.js +1 -1
  193. package/lib/module/useOnAction.js.map +1 -1
  194. package/lib/module/useOnGetState.js +2 -3
  195. package/lib/module/useOnGetState.js.map +1 -1
  196. package/lib/module/useOnPreventRemove.js +3 -4
  197. package/lib/module/useOnPreventRemove.js.map +1 -1
  198. package/lib/module/useOnRouteFocus.js.map +1 -1
  199. package/lib/module/useOptionsGetters.js +7 -8
  200. package/lib/module/useOptionsGetters.js.map +1 -1
  201. package/lib/module/usePreventRemove.js +1 -1
  202. package/lib/module/usePreventRemove.js.map +1 -1
  203. package/lib/module/usePreventRemoveContext.js.map +1 -1
  204. package/lib/module/useRegisterNavigator.js.map +1 -1
  205. package/lib/module/useRoute.js.map +1 -1
  206. package/lib/module/useRouteCache.js.map +1 -1
  207. package/lib/module/useSyncState.js +25 -54
  208. package/lib/module/useSyncState.js.map +1 -1
  209. package/lib/module/validatePathConfig.js.map +1 -1
  210. package/lib/typescript/src/BaseNavigationContainer.d.ts +1 -1
  211. package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -1
  212. package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -1
  213. package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -1
  214. package/lib/typescript/src/NavigationContext.d.ts +1 -17
  215. package/lib/typescript/src/NavigationContext.d.ts.map +1 -1
  216. package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -1
  217. package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -1
  218. package/lib/typescript/src/NavigationIndependentTree.d.ts +1 -1
  219. package/lib/typescript/src/NavigationIndependentTree.d.ts.map +1 -1
  220. package/lib/typescript/src/NavigationRouteContext.d.ts +1 -1
  221. package/lib/typescript/src/NavigationRouteContext.d.ts.map +1 -1
  222. package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -1
  223. package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
  224. package/lib/typescript/src/SceneView.d.ts +2 -1
  225. package/lib/typescript/src/SceneView.d.ts.map +1 -1
  226. package/lib/typescript/src/StaticNavigation.d.ts +1 -1
  227. package/lib/typescript/src/StaticNavigation.d.ts.map +1 -1
  228. package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -1
  229. package/lib/typescript/src/index.d.ts +1 -1
  230. package/lib/typescript/src/index.d.ts.map +1 -1
  231. package/lib/typescript/src/types.d.ts +25 -0
  232. package/lib/typescript/src/types.d.ts.map +1 -1
  233. package/lib/typescript/src/useComponent.d.ts +1 -1
  234. package/lib/typescript/src/useComponent.d.ts.map +1 -1
  235. package/lib/typescript/src/useDescriptors.d.ts +4 -8
  236. package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
  237. package/lib/typescript/src/useFocusEffect.d.ts.map +1 -1
  238. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +1 -1
  239. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -1
  240. package/lib/typescript/src/useIsomorphicLayoutEffect.d.ts +6 -0
  241. package/lib/typescript/src/useIsomorphicLayoutEffect.d.ts.map +1 -0
  242. package/lib/typescript/src/useIsomorphicLayoutEffect.native.d.ts +3 -0
  243. package/lib/typescript/src/useIsomorphicLayoutEffect.native.d.ts.map +1 -0
  244. package/lib/typescript/src/useNavigationBuilder.d.ts +39 -17
  245. package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
  246. package/lib/typescript/src/useNavigationCache.d.ts +1 -1
  247. package/lib/typescript/src/useNavigationCache.d.ts.map +1 -1
  248. package/lib/typescript/src/useNavigationHelpers.d.ts +35 -18
  249. package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -1
  250. package/lib/typescript/src/useOnAction.d.ts +1 -1
  251. package/lib/typescript/src/useOnAction.d.ts.map +1 -1
  252. package/lib/typescript/src/useOnGetState.d.ts +1 -1
  253. package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
  254. package/lib/typescript/src/useOnPreventRemove.d.ts +1 -1
  255. package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -1
  256. package/lib/typescript/src/useRouteCache.d.ts +1 -1
  257. package/lib/typescript/src/useRouteCache.d.ts.map +1 -1
  258. package/lib/typescript/src/useSyncState.d.ts +1 -4
  259. package/lib/typescript/src/useSyncState.d.ts.map +1 -1
  260. package/lib/typescript/utils/usePrevious.d.ts +6 -0
  261. package/lib/typescript/utils/usePrevious.d.ts.map +1 -0
  262. package/package.json +13 -13
  263. package/src/BaseNavigationContainer.tsx +27 -36
  264. package/src/Group.tsx +1 -1
  265. package/src/PreventRemoveProvider.tsx +4 -1
  266. package/src/SceneView.tsx +1 -1
  267. package/src/Screen.tsx +1 -1
  268. package/src/StaticNavigation.tsx +7 -7
  269. package/src/checkDuplicateRouteNames.tsx +1 -1
  270. package/src/createNavigationContainerRef.tsx +1 -1
  271. package/src/createNavigatorFactory.tsx +2 -4
  272. package/src/getActionFromState.tsx +1 -1
  273. package/src/getPathFromState.tsx +6 -8
  274. package/src/getStateFromPath.tsx +6 -3
  275. package/src/index.tsx +2 -2
  276. package/src/types.tsx +59 -16
  277. package/src/useDescriptors.tsx +7 -27
  278. package/src/useFocusEffect.tsx +1 -0
  279. package/src/useFocusedListenersChildrenAdapter.tsx +2 -2
  280. package/src/useIsomorphicLayoutEffect.native.tsx +3 -0
  281. package/src/useIsomorphicLayoutEffect.tsx +7 -0
  282. package/src/useNavigation.tsx +1 -1
  283. package/src/useNavigationBuilder.tsx +99 -94
  284. package/src/useNavigationCache.tsx +7 -7
  285. package/src/useNavigationContainerRef.tsx +1 -1
  286. package/src/useNavigationHelpers.tsx +6 -7
  287. package/src/useOnAction.tsx +2 -2
  288. package/src/useOnGetState.tsx +1 -1
  289. package/src/useOnPreventRemove.tsx +1 -1
  290. package/src/useOptionsGetters.tsx +2 -2
  291. package/src/useSyncState.tsx +31 -59
  292. package/lib/commonjs/useScheduleUpdate.js +0 -37
  293. package/lib/commonjs/useScheduleUpdate.js.map +0 -1
  294. package/lib/module/useScheduleUpdate.js +0 -27
  295. package/lib/module/useScheduleUpdate.js.map +0 -1
  296. package/lib/typescript/src/useScheduleUpdate.d.ts +0 -14
  297. package/lib/typescript/src/useScheduleUpdate.d.ts.map +0 -1
  298. package/src/useScheduleUpdate.tsx +0 -32
@@ -1,17 +1,18 @@
1
1
  import {
2
2
  CommonActions,
3
- DefaultRouterOptions,
4
- NavigationAction,
5
- NavigationState,
6
- ParamListBase,
7
- PartialState,
8
- Route,
9
- Router,
10
- RouterConfigOptions,
11
- RouterFactory,
3
+ type DefaultRouterOptions,
4
+ type NavigationAction,
5
+ type NavigationState,
6
+ type ParamListBase,
7
+ type PartialState,
8
+ type Route,
9
+ type Router,
10
+ type RouterConfigOptions,
11
+ type RouterFactory,
12
12
  } from '@react-navigation/routers';
13
13
  import * as React from 'react';
14
14
  import { isValidElementType } from 'react-is';
15
+ import useLatestCallback from 'use-latest-callback';
15
16
 
16
17
  import { Group } from './Group';
17
18
  import { isArrayEqual } from './isArrayEqual';
@@ -22,47 +23,31 @@ import { NavigationStateContext } from './NavigationStateContext';
22
23
  import { PreventRemoveProvider } from './PreventRemoveProvider';
23
24
  import { Screen } from './Screen';
24
25
  import {
25
- DefaultNavigatorOptions,
26
- EventMapBase,
27
- EventMapCore,
28
- NavigatorScreenParams,
26
+ type DefaultNavigatorOptions,
27
+ type EventMapBase,
28
+ type EventMapCore,
29
+ type NavigatorScreenParams,
29
30
  PrivateValueStore,
30
- RouteConfig,
31
- RouteProp,
31
+ type RouteConfig,
32
32
  } from './types';
33
33
  import { useChildListeners } from './useChildListeners';
34
34
  import { useComponent } from './useComponent';
35
35
  import { useCurrentRender } from './useCurrentRender';
36
- import { ScreenConfigWithParent, useDescriptors } from './useDescriptors';
36
+ import { type ScreenConfigWithParent, useDescriptors } from './useDescriptors';
37
37
  import { useEventEmitter } from './useEventEmitter';
38
38
  import { useFocusedListenersChildrenAdapter } from './useFocusedListenersChildrenAdapter';
39
39
  import { useFocusEvents } from './useFocusEvents';
40
+ import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
40
41
  import { useKeyedChildListeners } from './useKeyedChildListeners';
41
42
  import { useNavigationHelpers } from './useNavigationHelpers';
42
43
  import { useOnAction } from './useOnAction';
43
44
  import { useOnGetState } from './useOnGetState';
44
45
  import { useOnRouteFocus } from './useOnRouteFocus';
45
46
  import { useRegisterNavigator } from './useRegisterNavigator';
46
- import { useScheduleUpdate } from './useScheduleUpdate';
47
47
 
48
48
  // This is to make TypeScript compiler happy
49
- // eslint-disable-next-line babel/no-unused-expressions
50
49
  PrivateValueStore;
51
50
 
52
- type NavigationBuilderOptions<ScreenOptions extends {}> = {
53
- /**
54
- * Default options specified by the navigator.
55
- * It receives the custom options in the arguments if a function is specified.
56
- */
57
- defaultScreenOptions?:
58
- | ScreenOptions
59
- | ((props: {
60
- route: RouteProp<ParamListBase>;
61
- navigation: any;
62
- options: ScreenOptions;
63
- }) => ScreenOptions);
64
- };
65
-
66
51
  type NavigatorRoute = {
67
52
  key: string;
68
53
  params?: NavigatorScreenParams<ParamListBase>;
@@ -79,7 +64,7 @@ const isValidKey = (key: unknown) =>
79
64
  const getRouteConfigsFromChildren = <
80
65
  State extends NavigationState,
81
66
  ScreenOptions extends {},
82
- EventMap extends EventMapBase
67
+ EventMap extends EventMapBase,
83
68
  >(
84
69
  children: React.ReactNode,
85
70
  groupKey?: string,
@@ -257,7 +242,7 @@ export function useNavigationBuilder<
257
242
  RouterOptions extends DefaultRouterOptions,
258
243
  ActionHelpers extends Record<string, () => void>,
259
244
  ScreenOptions extends {},
260
- EventMap extends Record<string, any>
245
+ EventMap extends Record<string, any>,
261
246
  >(
262
247
  createRouter: RouterFactory<State, any, RouterOptions>,
263
248
  options: DefaultNavigatorOptions<
@@ -266,7 +251,6 @@ export function useNavigationBuilder<
266
251
  ScreenOptions,
267
252
  EventMap
268
253
  > &
269
- NavigationBuilderOptions<ScreenOptions> &
270
254
  RouterOptions
271
255
  ) {
272
256
  const navigatorKey = useRegisterNavigator();
@@ -275,17 +259,9 @@ export function useNavigationBuilder<
275
259
  | NavigatorRoute
276
260
  | undefined;
277
261
 
278
- const { children, screenListeners, ...rest } = options;
262
+ const { children, layout, screenOptions, screenListeners, ...rest } = options;
279
263
  const { current: router } = React.useRef<Router<State, any>>(
280
- createRouter({
281
- ...(rest as unknown as RouterOptions),
282
- ...(route?.params &&
283
- route.params.state == null &&
284
- route.params.initial !== false &&
285
- typeof route.params.screen === 'string'
286
- ? { initialRouteName: route.params.screen }
287
- : null),
288
- })
264
+ createRouter(rest as unknown as RouterOptions)
289
265
  );
290
266
 
291
267
  const routeConfigs = getRouteConfigsFromChildren<
@@ -362,12 +338,7 @@ export function useNavigationBuilder<
362
338
 
363
339
  const stateCleanedUp = React.useRef(false);
364
340
 
365
- const cleanUpState = React.useCallback(() => {
366
- setCurrentState(undefined);
367
- stateCleanedUp.current = true;
368
- }, [setCurrentState]);
369
-
370
- const setState = React.useCallback(
341
+ const setState = useLatestCallback(
371
342
  (state: NavigationState | PartialState<NavigationState> | undefined) => {
372
343
  if (stateCleanedUp.current) {
373
344
  // State might have been already cleaned up due to unmount
@@ -375,9 +346,9 @@ export function useNavigationBuilder<
375
346
  // This would lead to old data preservation on main navigator unmount
376
347
  return;
377
348
  }
349
+
378
350
  setCurrentState(state);
379
- },
380
- [setCurrentState]
351
+ }
381
352
  );
382
353
 
383
354
  const [initializedState, isFirstStateInitialization] = React.useMemo(() => {
@@ -409,7 +380,11 @@ export function useNavigationBuilder<
409
380
  // So we need to rehydrate it to make it usable
410
381
  if (
411
382
  (currentState === undefined || !isStateValid(currentState)) &&
412
- route?.params?.state == null
383
+ route?.params?.state == null &&
384
+ !(
385
+ typeof route?.params?.screen === 'string' &&
386
+ route?.params?.initial !== false
387
+ )
413
388
  ) {
414
389
  return [
415
390
  router.getInitialState({
@@ -420,9 +395,29 @@ export function useNavigationBuilder<
420
395
  true,
421
396
  ];
422
397
  } else {
398
+ let stateFromParams;
399
+
400
+ if (route?.params?.state != null) {
401
+ stateFromParams = route.params.state;
402
+ } else if (
403
+ typeof route?.params?.screen === 'string' &&
404
+ route?.params?.initial !== false
405
+ ) {
406
+ stateFromParams = {
407
+ index: 0,
408
+ routes: [
409
+ {
410
+ name: route.params.screen,
411
+ params: route.params.params,
412
+ path: route.params.path,
413
+ },
414
+ ],
415
+ };
416
+ }
417
+
423
418
  return [
424
419
  router.getRehydratedState(
425
- (route?.params?.state ?? currentState) as PartialState<State>,
420
+ (stateFromParams ?? currentState) as PartialState<State>,
426
421
  {
427
422
  routeNames,
428
423
  routeParamList: initialRouteParamList,
@@ -462,17 +457,26 @@ export function useNavigationBuilder<
462
457
  !isArrayEqual(state.routeNames, routeNames) ||
463
458
  !isRecordEqual(routeKeyList, previousRouteKeyList)
464
459
  ) {
460
+ const navigatorStateForNextRouteNamesChange =
461
+ options.getStateForRouteNamesChange?.(state);
465
462
  // When the list of route names change, the router should handle it to remove invalid routes
466
- nextState = router.getStateForRouteNamesChange(state, {
467
- routeNames,
468
- routeParamList,
469
- routeGetIdList,
470
- routeKeyChanges: Object.keys(routeKeyList).filter(
471
- (name) =>
472
- previousRouteKeyList.hasOwnProperty(name) &&
473
- routeKeyList[name] !== previousRouteKeyList[name]
474
- ),
475
- });
463
+ nextState = navigatorStateForNextRouteNamesChange
464
+ ? // @ts-expect-error this is ok
465
+ router.getRehydratedState(navigatorStateForNextRouteNamesChange, {
466
+ routeNames,
467
+ routeParamList,
468
+ routeGetIdList,
469
+ })
470
+ : router.getStateForRouteNamesChange(state, {
471
+ routeNames,
472
+ routeParamList,
473
+ routeGetIdList,
474
+ routeKeyChanges: Object.keys(routeKeyList).filter(
475
+ (name) =>
476
+ name in previousRouteKeyList &&
477
+ routeKeyList[name] !== previousRouteKeyList[name]
478
+ ),
479
+ });
476
480
  }
477
481
 
478
482
  const previousNestedParamsRef = React.useRef(route?.params);
@@ -527,7 +531,7 @@ export function useNavigationBuilder<
527
531
 
528
532
  const shouldUpdate = state !== nextState;
529
533
 
530
- useScheduleUpdate(() => {
534
+ useIsomorphicLayoutEffect(() => {
531
535
  if (shouldUpdate) {
532
536
  // If the state needs to be updated, we'll schedule an update
533
537
  setState(nextState);
@@ -551,34 +555,24 @@ export function useNavigationBuilder<
551
555
 
552
556
  return () => {
553
557
  // We need to clean up state for this navigator on unmount
554
- // We do it in a timeout because we need to detect if another navigator mounted in the meantime
555
- // For example, if another navigator has started rendering, we should skip cleanup
556
- // Otherwise, our cleanup step will cleanup state for the other navigator and re-initialize it
557
- setTimeout(() => {
558
- if (getCurrentState() !== undefined && getKey() === navigatorKey) {
559
- cleanUpState();
560
- }
561
- }, 0);
558
+ if (getCurrentState() !== undefined && getKey() === navigatorKey) {
559
+ setCurrentState(undefined);
560
+ stateCleanedUp.current = true;
561
+ }
562
562
  };
563
563
  // eslint-disable-next-line react-hooks/exhaustive-deps
564
564
  }, []);
565
565
 
566
- // We initialize this ref here to avoid a new getState getting initialized
567
- // whenever initializedState changes. We want getState to have access to the
568
- // latest initializedState, but don't need it to change when that happens
569
- const initializedStateRef = React.useRef<State>();
570
- initializedStateRef.current = initializedState;
571
-
572
- const getState = React.useCallback((): State => {
573
- const currentState = getCurrentState();
566
+ const getState = useLatestCallback((): State => {
567
+ const currentState = shouldUpdate ? nextState : getCurrentState();
574
568
 
575
- return isStateInitialized(currentState)
576
- ? (currentState as State)
577
- : (initializedStateRef.current as State);
578
- }, [getCurrentState, isStateInitialized]);
569
+ return (
570
+ isStateInitialized(currentState) ? currentState : initializedState
571
+ ) as State;
572
+ });
579
573
 
580
574
  const emitter = useEventEmitter<EventMapCore<State>>((e) => {
581
- let routeNames = [];
575
+ const routeNames = [];
582
576
 
583
577
  let route: Route<string> | undefined;
584
578
 
@@ -694,8 +688,7 @@ export function useNavigationBuilder<
694
688
  state,
695
689
  screens,
696
690
  navigation,
697
- screenOptions: options.screenOptions,
698
- defaultScreenOptions: options.defaultScreenOptions,
691
+ screenOptions,
699
692
  onAction,
700
693
  getState,
701
694
  setState,
@@ -713,11 +706,23 @@ export function useNavigationBuilder<
713
706
  descriptors,
714
707
  });
715
708
 
716
- const NavigationContent = useComponent((children: React.ReactNode) => (
717
- <NavigationHelpersContext.Provider value={navigation}>
718
- <PreventRemoveProvider>{children}</PreventRemoveProvider>
719
- </NavigationHelpersContext.Provider>
720
- ));
709
+ const NavigationContent = useComponent((children: React.ReactNode) => {
710
+ const element =
711
+ layout != null
712
+ ? layout({
713
+ state,
714
+ descriptors,
715
+ navigation,
716
+ children,
717
+ })
718
+ : children;
719
+
720
+ return (
721
+ <NavigationHelpersContext.Provider value={navigation}>
722
+ <PreventRemoveProvider>{element}</PreventRemoveProvider>
723
+ </NavigationHelpersContext.Provider>
724
+ );
725
+ });
721
726
 
722
727
  return {
723
728
  state,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CommonActions,
3
- NavigationAction,
4
- NavigationState,
5
- ParamListBase,
6
- Router,
3
+ type NavigationAction,
4
+ type NavigationState,
5
+ type ParamListBase,
6
+ type Router,
7
7
  } from '@react-navigation/routers';
8
8
  import * as React from 'react';
9
9
 
@@ -14,7 +14,7 @@ import type { NavigationEventEmitter } from './useEventEmitter';
14
14
  type Options<
15
15
  State extends NavigationState,
16
16
  ScreenOptions extends {},
17
- EventMap extends Record<string, any>
17
+ EventMap extends Record<string, any>,
18
18
  > = {
19
19
  state: State;
20
20
  getState: () => State;
@@ -32,7 +32,7 @@ type Options<
32
32
  type NavigationCache<
33
33
  State extends NavigationState,
34
34
  ScreenOptions extends {},
35
- EventMap extends Record<string, any>
35
+ EventMap extends Record<string, any>,
36
36
  > = Record<
37
37
  string,
38
38
  NavigationProp<
@@ -53,7 +53,7 @@ type NavigationCache<
53
53
  export function useNavigationCache<
54
54
  State extends NavigationState,
55
55
  ScreenOptions extends {},
56
- EventMap extends Record<string, any>
56
+ EventMap extends Record<string, any>,
57
57
  >({
58
58
  state,
59
59
  getState,
@@ -4,7 +4,7 @@ import { createNavigationContainerRef } from './createNavigationContainerRef';
4
4
  import type { NavigationContainerRefWithCurrent } from './types';
5
5
 
6
6
  export function useNavigationContainerRef<
7
- ParamList extends {} = ReactNavigation.RootParamList
7
+ ParamList extends {} = ReactNavigation.RootParamList,
8
8
  >(): NavigationContainerRefWithCurrent<ParamList> {
9
9
  const navigation =
10
10
  React.useRef<NavigationContainerRefWithCurrent<ParamList> | null>(null);
@@ -1,19 +1,18 @@
1
1
  import {
2
2
  CommonActions,
3
- NavigationAction,
4
- NavigationState,
5
- ParamListBase,
6
- Router,
3
+ type NavigationAction,
4
+ type NavigationState,
5
+ type ParamListBase,
6
+ type Router,
7
7
  } from '@react-navigation/routers';
8
8
  import * as React from 'react';
9
9
 
10
10
  import { NavigationContext } from './NavigationContext';
11
- import { NavigationHelpers, PrivateValueStore } from './types';
11
+ import { type NavigationHelpers, PrivateValueStore } from './types';
12
12
  import { UnhandledActionContext } from './UnhandledActionContext';
13
13
  import type { NavigationEventEmitter } from './useEventEmitter';
14
14
 
15
15
  // This is to make TypeScript compiler happy
16
- // eslint-disable-next-line babel/no-unused-expressions
17
16
  PrivateValueStore;
18
17
 
19
18
  type Options<State extends NavigationState, Action extends NavigationAction> = {
@@ -32,7 +31,7 @@ export function useNavigationHelpers<
32
31
  State extends NavigationState,
33
32
  ActionHelpers extends Record<string, () => void>,
34
33
  Action extends NavigationAction,
35
- EventMap extends Record<string, any>
34
+ EventMap extends Record<string, any>,
36
35
  >({
37
36
  id: navigatorId,
38
37
  onAction,
@@ -9,8 +9,8 @@ import * as React from 'react';
9
9
 
10
10
  import { DeprecatedNavigationInChildContext } from './DeprecatedNavigationInChildContext';
11
11
  import {
12
- ChildActionListener,
13
- ChildBeforeRemoveListener,
12
+ type ChildActionListener,
13
+ type ChildBeforeRemoveListener,
14
14
  NavigationBuilderContext,
15
15
  } from './NavigationBuilderContext';
16
16
  import type { EventMapCore } from './types';
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
 
4
4
  import { isArrayEqual } from './isArrayEqual';
5
5
  import {
6
- GetStateListener,
6
+ type GetStateListener,
7
7
  NavigationBuilderContext,
8
8
  } from './NavigationBuilderContext';
9
9
  import { NavigationRouteContext } from './NavigationRouteContext';
@@ -5,7 +5,7 @@ import type {
5
5
  import * as React from 'react';
6
6
 
7
7
  import {
8
- ChildBeforeRemoveListener,
8
+ type ChildBeforeRemoveListener,
9
9
  NavigationBuilderContext,
10
10
  } from './NavigationBuilderContext';
11
11
  import { NavigationRouteContext } from './NavigationRouteContext';
@@ -39,8 +39,8 @@ export function useOptionsGetters({ key, options, navigation }: Options) {
39
39
  }, [navigation, options, optionsChangeListener]);
40
40
 
41
41
  const getOptionsFromListener = React.useCallback(() => {
42
- for (let key in optionsGettersFromChildRef.current) {
43
- if (optionsGettersFromChildRef.current.hasOwnProperty(key)) {
42
+ for (const key in optionsGettersFromChildRef.current) {
43
+ if (key in optionsGettersFromChildRef.current) {
44
44
  const result = optionsGettersFromChildRef.current[key]?.();
45
45
 
46
46
  // null means unfocused route
@@ -1,74 +1,46 @@
1
1
  import * as React from 'react';
2
2
 
3
- const UNINTIALIZED_STATE = {};
3
+ const createStore = <T,>(getInitialState: () => T) => {
4
+ const listeners: (() => void)[] = [];
4
5
 
5
- /**
6
- * This is definitely not compatible with concurrent mode, but we don't have a solution for sync state yet.
7
- */
8
- export function useSyncState<T>(initialState?: (() => T) | T) {
9
- const stateRef = React.useRef<T>(UNINTIALIZED_STATE as any);
10
- const isSchedulingRef = React.useRef(false);
11
- const isMountedRef = React.useRef(true);
6
+ let state: T = getInitialState();
12
7
 
13
- React.useEffect(() => {
14
- isMountedRef.current = true;
8
+ const getState = () => state;
15
9
 
16
- return () => {
17
- isMountedRef.current = false;
18
- };
19
- }, []);
20
-
21
- if (stateRef.current === UNINTIALIZED_STATE) {
22
- stateRef.current =
23
- // @ts-expect-error: initialState is a function, but TypeScript doesn't think so
24
- typeof initialState === 'function' ? initialState() : initialState;
25
- }
26
-
27
- const [trackingState, setTrackingState] = React.useState(stateRef.current);
28
-
29
- const getState = React.useCallback(() => stateRef.current, []);
10
+ const setState = (newState: T) => {
11
+ state = newState;
12
+ listeners.forEach((listener) => listener());
13
+ };
30
14
 
31
- const setState = React.useCallback((state: T) => {
32
- if (state === stateRef.current || !isMountedRef.current) {
33
- return;
34
- }
15
+ const subscribe = (callback: () => void) => {
16
+ listeners.push(callback);
35
17
 
36
- stateRef.current = state;
37
-
38
- if (!isSchedulingRef.current) {
39
- setTrackingState(state);
40
- }
41
- }, []);
42
-
43
- const scheduleUpdate = React.useCallback((callback: () => void) => {
44
- isSchedulingRef.current = true;
45
-
46
- try {
47
- callback();
48
- } finally {
49
- isSchedulingRef.current = false;
50
- }
51
- }, []);
18
+ return () => {
19
+ const index = listeners.indexOf(callback);
52
20
 
53
- const flushUpdates = React.useCallback(() => {
54
- if (!isMountedRef.current) {
55
- return;
56
- }
21
+ if (index > -1) {
22
+ listeners.splice(index, 1);
23
+ }
24
+ };
25
+ };
57
26
 
58
- // Make sure that the tracking state is up-to-date.
59
- // We call it unconditionally, but React should skip the update if state is unchanged.
60
- setTrackingState(stateRef.current);
61
- }, []);
27
+ return {
28
+ getState,
29
+ setState,
30
+ subscribe,
31
+ };
32
+ };
62
33
 
63
- // If we're rendering and the tracking state is out of date, update it immediately
64
- // This will make sure that our updates are applied as early as possible.
65
- if (trackingState !== stateRef.current) {
66
- setTrackingState(stateRef.current);
67
- }
34
+ export function useSyncState<T>(getInitialState: () => T) {
35
+ const store = React.useRef(createStore(getInitialState)).current;
68
36
 
69
- const state = stateRef.current;
37
+ const state = React.useSyncExternalStore(
38
+ store.subscribe,
39
+ store.getState,
40
+ store.getState
41
+ );
70
42
 
71
43
  React.useDebugValue(state);
72
44
 
73
- return [state, getState, setState, scheduleUpdate, flushUpdates] as const;
45
+ return [state, store.getState, store.setState] as const;
74
46
  }
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ScheduleUpdateContext = void 0;
7
- exports.useScheduleUpdate = useScheduleUpdate;
8
- var React = _interopRequireWildcard(require("react"));
9
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- const MISSING_CONTEXT_ERROR = "Couldn't find a schedule context.";
12
- const ScheduleUpdateContext = /*#__PURE__*/React.createContext({
13
- scheduleUpdate() {
14
- throw new Error(MISSING_CONTEXT_ERROR);
15
- },
16
- flushUpdates() {
17
- throw new Error(MISSING_CONTEXT_ERROR);
18
- }
19
- });
20
-
21
- /**
22
- * When screen config changes, we want to update the navigator in the same update phase.
23
- * However, navigation state is in the root component and React won't let us update it from a child.
24
- * This is a workaround for that, the scheduled update is stored in the ref without actually calling setState.
25
- * It lets all subsequent updates access the latest state so it stays correct.
26
- * Then we call setState during after the component updates.
27
- */
28
- exports.ScheduleUpdateContext = ScheduleUpdateContext;
29
- function useScheduleUpdate(callback) {
30
- const {
31
- scheduleUpdate,
32
- flushUpdates
33
- } = React.useContext(ScheduleUpdateContext);
34
- scheduleUpdate(callback);
35
- React.useEffect(flushUpdates);
36
- }
37
- //# sourceMappingURL=useScheduleUpdate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["MISSING_CONTEXT_ERROR","ScheduleUpdateContext","React","createContext","scheduleUpdate","Error","flushUpdates","useScheduleUpdate","callback","useContext","useEffect"],"sourceRoot":"../../src","sources":["useScheduleUpdate.tsx"],"mappings":";;;;;;;AAAA;AAA+B;AAAA;AAE/B,MAAMA,qBAAqB,GAAG,mCAAmC;AAE1D,MAAMC,qBAAqB,gBAAGC,KAAK,CAACC,aAAa,CAGrD;EACDC,cAAc,GAAG;IACf,MAAM,IAAIC,KAAK,CAACL,qBAAqB,CAAC;EACxC,CAAC;EACDM,YAAY,GAAG;IACb,MAAM,IAAID,KAAK,CAACL,qBAAqB,CAAC;EACxC;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAOO,SAASO,iBAAiB,CAACC,QAAoB,EAAE;EACtD,MAAM;IAAEJ,cAAc;IAAEE;EAAa,CAAC,GAAGJ,KAAK,CAACO,UAAU,CACvDR,qBAAqB,CACtB;EAEDG,cAAc,CAACI,QAAQ,CAAC;EAExBN,KAAK,CAACQ,SAAS,CAACJ,YAAY,CAAC;AAC/B"}
@@ -1,27 +0,0 @@
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
- flushUpdates() {
8
- throw new Error(MISSING_CONTEXT_ERROR);
9
- }
10
- });
11
-
12
- /**
13
- * When screen config changes, we want to update the navigator in the same update phase.
14
- * However, navigation state is in the root component and React won't let us update it from a child.
15
- * This is a workaround for that, the scheduled update is stored in the ref without actually calling setState.
16
- * It lets all subsequent updates access the latest state so it stays correct.
17
- * Then we call setState during after the component updates.
18
- */
19
- export function useScheduleUpdate(callback) {
20
- const {
21
- scheduleUpdate,
22
- flushUpdates
23
- } = React.useContext(ScheduleUpdateContext);
24
- scheduleUpdate(callback);
25
- React.useEffect(flushUpdates);
26
- }
27
- //# sourceMappingURL=useScheduleUpdate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","MISSING_CONTEXT_ERROR","ScheduleUpdateContext","createContext","scheduleUpdate","Error","flushUpdates","useScheduleUpdate","callback","useContext","useEffect"],"sourceRoot":"../../src","sources":["useScheduleUpdate.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,MAAMC,qBAAqB,GAAG,mCAAmC;AAEjE,OAAO,MAAMC,qBAAqB,gBAAGF,KAAK,CAACG,aAAa,CAGrD;EACDC,cAAc,GAAG;IACf,MAAM,IAAIC,KAAK,CAACJ,qBAAqB,CAAC;EACxC,CAAC;EACDK,YAAY,GAAG;IACb,MAAM,IAAID,KAAK,CAACJ,qBAAqB,CAAC;EACxC;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,iBAAiB,CAACC,QAAoB,EAAE;EACtD,MAAM;IAAEJ,cAAc;IAAEE;EAAa,CAAC,GAAGN,KAAK,CAACS,UAAU,CACvDP,qBAAqB,CACtB;EAEDE,cAAc,CAACI,QAAQ,CAAC;EAExBR,KAAK,CAACU,SAAS,CAACJ,YAAY,CAAC;AAC/B"}
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- export declare const ScheduleUpdateContext: React.Context<{
3
- scheduleUpdate: (callback: () => void) => void;
4
- flushUpdates: () => void;
5
- }>;
6
- /**
7
- * When screen config changes, we want to update the navigator in the same update phase.
8
- * However, navigation state is in the root component and React won't let us update it from a child.
9
- * This is a workaround for that, the scheduled update is stored in the ref without actually calling setState.
10
- * It lets all subsequent updates access the latest state so it stays correct.
11
- * Then we call setState during after the component updates.
12
- */
13
- export declare function useScheduleUpdate(callback: () => void): void;
14
- //# sourceMappingURL=useScheduleUpdate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useScheduleUpdate.d.ts","sourceRoot":"","sources":["../../../src/useScheduleUpdate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,qBAAqB;+BACL,MAAM,IAAI,KAAK,IAAI;kBAChC,MAAM,IAAI;EAQxB,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,QAQrD"}