@react-navigation/core 8.0.0-alpha.35 → 8.0.0-alpha.37

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 (41) hide show
  1. package/lib/module/BaseNavigationContainer.js +2 -1
  2. package/lib/module/BaseNavigationContainer.js.map +1 -1
  3. package/lib/module/PreventRemoveProvider.js +1 -2
  4. package/lib/module/PreventRemoveProvider.js.map +1 -1
  5. package/lib/module/getPathFromState.js +11 -7
  6. package/lib/module/getPathFromState.js.map +1 -1
  7. package/lib/module/getStateFromPath.js +1 -1
  8. package/lib/module/getStateFromPath.js.map +1 -1
  9. package/lib/module/isRecordEqual.js +1 -1
  10. package/lib/module/isRecordEqual.js.map +1 -1
  11. package/lib/module/queryString.js +71 -0
  12. package/lib/module/queryString.js.map +1 -0
  13. package/lib/module/useDescriptors.js +34 -10
  14. package/lib/module/useDescriptors.js.map +1 -1
  15. package/lib/module/useOptionsGetters.js +7 -1
  16. package/lib/module/useOptionsGetters.js.map +1 -1
  17. package/lib/module/usePreventRemove.js +1 -2
  18. package/lib/module/usePreventRemove.js.map +1 -1
  19. package/lib/module/useRegisterNavigator.js +1 -2
  20. package/lib/module/useRegisterNavigator.js.map +1 -1
  21. package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -1
  22. package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
  23. package/lib/typescript/src/getPathFromState.d.ts.map +1 -1
  24. package/lib/typescript/src/isRecordEqual.d.ts.map +1 -1
  25. package/lib/typescript/src/queryString.d.ts +5 -0
  26. package/lib/typescript/src/queryString.d.ts.map +1 -0
  27. package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
  28. package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -1
  29. package/lib/typescript/src/usePreventRemove.d.ts.map +1 -1
  30. package/lib/typescript/src/useRegisterNavigator.d.ts.map +1 -1
  31. package/package.json +2 -4
  32. package/src/BaseNavigationContainer.tsx +4 -2
  33. package/src/PreventRemoveProvider.tsx +2 -2
  34. package/src/getPathFromState.tsx +7 -5
  35. package/src/getStateFromPath.tsx +1 -1
  36. package/src/isRecordEqual.tsx +3 -1
  37. package/src/queryString.ts +109 -0
  38. package/src/useDescriptors.tsx +94 -22
  39. package/src/useOptionsGetters.tsx +7 -1
  40. package/src/usePreventRemove.tsx +1 -2
  41. package/src/useRegisterNavigator.tsx +2 -2
@@ -1,5 +1,4 @@
1
1
  import type { NavigationAction } from '@react-navigation/routers';
2
- import { nanoid } from 'nanoid/non-secure';
3
2
  import * as React from 'react';
4
3
  import useLatestCallback from 'use-latest-callback';
5
4
 
@@ -18,7 +17,7 @@ export function usePreventRemove(
18
17
  preventRemove: boolean,
19
18
  callback: (options: { data: { action: NavigationAction } }) => void
20
19
  ) {
21
- const [id] = React.useState(() => nanoid());
20
+ const id = React.useId();
22
21
 
23
22
  const navigation = useNavigation();
24
23
  const { key: routeKey } = useRoute();
@@ -1,4 +1,3 @@
1
- import { nanoid } from 'nanoid/non-secure';
2
1
  import * as React from 'react';
3
2
 
4
3
  import { SingleNavigatorContext } from './EnsureSingleNavigator';
@@ -8,7 +7,8 @@ import { SingleNavigatorContext } from './EnsureSingleNavigator';
8
7
  * This is used to prevent multiple navigators under a single container or screen.
9
8
  */
10
9
  export function useRegisterNavigator() {
11
- const [key] = React.useState(() => nanoid());
10
+ const key = React.useId();
11
+
12
12
  const container = React.use(SingleNavigatorContext);
13
13
 
14
14
  if (container === undefined) {