@react-navigation/core 6.4.7 → 6.4.9

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 (70) hide show
  1. package/lib/commonjs/checkDuplicateRouteNames.js.map +1 -1
  2. package/lib/commonjs/types.js +1 -8
  3. package/lib/commonjs/types.js.map +1 -1
  4. package/lib/commonjs/useDescriptors.js +3 -1
  5. package/lib/commonjs/useDescriptors.js.map +1 -1
  6. package/lib/commonjs/useNavigationBuilder.js +1 -1
  7. package/lib/commonjs/useNavigationBuilder.js.map +1 -1
  8. package/lib/module/checkDuplicateRouteNames.js.map +1 -1
  9. package/lib/module/types.js +1 -8
  10. package/lib/module/types.js.map +1 -1
  11. package/lib/module/useDescriptors.js +3 -1
  12. package/lib/module/useDescriptors.js.map +1 -1
  13. package/lib/module/useNavigationBuilder.js +1 -1
  14. package/lib/module/useNavigationBuilder.js.map +1 -1
  15. package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -1
  16. package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -1
  17. package/lib/typescript/src/NavigationBuilderContext.d.ts +9 -9
  18. package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -1
  19. package/lib/typescript/src/PreventRemoveContext.d.ts +1 -1
  20. package/lib/typescript/src/PreventRemoveContext.d.ts.map +1 -1
  21. package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -1
  22. package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
  23. package/lib/typescript/src/SceneView.d.ts +1 -2
  24. package/lib/typescript/src/SceneView.d.ts.map +1 -1
  25. package/lib/typescript/src/getActionFromState.d.ts +2 -2
  26. package/lib/typescript/src/getActionFromState.d.ts.map +1 -1
  27. package/lib/typescript/src/getPathFromState.d.ts +2 -2
  28. package/lib/typescript/src/getPathFromState.d.ts.map +1 -1
  29. package/lib/typescript/src/getStateFromPath.d.ts +2 -2
  30. package/lib/typescript/src/getStateFromPath.d.ts.map +1 -1
  31. package/lib/typescript/src/types.d.ts +29 -29
  32. package/lib/typescript/src/types.d.ts.map +1 -1
  33. package/lib/typescript/src/useComponent.d.ts +1 -1
  34. package/lib/typescript/src/useComponent.d.ts.map +1 -1
  35. package/lib/typescript/src/useCurrentRender.d.ts +1 -1
  36. package/lib/typescript/src/useCurrentRender.d.ts.map +1 -1
  37. package/lib/typescript/src/useDescriptors.d.ts +3 -3
  38. package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
  39. package/lib/typescript/src/useEventEmitter.d.ts +1 -1
  40. package/lib/typescript/src/useEventEmitter.d.ts.map +1 -1
  41. package/lib/typescript/src/useFocusEffect.d.ts +1 -1
  42. package/lib/typescript/src/useFocusEffect.d.ts.map +1 -1
  43. package/lib/typescript/src/useFocusEvents.d.ts +1 -1
  44. package/lib/typescript/src/useFocusEvents.d.ts.map +1 -1
  45. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +1 -1
  46. package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -1
  47. package/lib/typescript/src/useNavigationBuilder.d.ts +1 -1
  48. package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
  49. package/lib/typescript/src/useNavigationCache.d.ts +2 -2
  50. package/lib/typescript/src/useNavigationCache.d.ts.map +1 -1
  51. package/lib/typescript/src/useNavigationHelpers.d.ts +1 -1
  52. package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -1
  53. package/lib/typescript/src/useNavigationState.d.ts +1 -1
  54. package/lib/typescript/src/useNavigationState.d.ts.map +1 -1
  55. package/lib/typescript/src/useOnAction.d.ts +1 -1
  56. package/lib/typescript/src/useOnAction.d.ts.map +1 -1
  57. package/lib/typescript/src/useOnGetState.d.ts +1 -1
  58. package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
  59. package/lib/typescript/src/useOnPreventRemove.d.ts +1 -1
  60. package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -1
  61. package/lib/typescript/src/useOnRouteFocus.d.ts +1 -1
  62. package/lib/typescript/src/useOnRouteFocus.d.ts.map +1 -1
  63. package/lib/typescript/src/useOptionsGetters.d.ts +1 -1
  64. package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -1
  65. package/package.json +9 -9
  66. package/src/checkDuplicateRouteNames.tsx +1 -1
  67. package/src/getPathFromState.tsx +1 -1
  68. package/src/types.tsx +1 -1
  69. package/src/useDescriptors.tsx +1 -0
  70. package/src/useNavigationBuilder.tsx +6 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/core",
3
3
  "description": "Core utilities for building navigators",
4
- "version": "6.4.7",
4
+ "version": "6.4.9",
5
5
  "keywords": [
6
6
  "react",
7
7
  "react-native",
@@ -35,7 +35,7 @@
35
35
  "clean": "del lib"
36
36
  },
37
37
  "dependencies": {
38
- "@react-navigation/routers": "^6.1.7",
38
+ "@react-navigation/routers": "^6.1.9",
39
39
  "escape-string-regexp": "^4.0.0",
40
40
  "nanoid": "^3.1.23",
41
41
  "query-string": "^7.1.3",
@@ -44,14 +44,14 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@testing-library/react-native": "^11.5.0",
47
- "@types/react": "~18.0.0",
47
+ "@types/react": "~18.0.27",
48
48
  "@types/react-is": "^17.0.0",
49
- "del-cli": "^3.0.1",
49
+ "del-cli": "^5.0.0",
50
50
  "immer": "^9.0.2",
51
- "react": "18.0.0",
52
- "react-native-builder-bob": "^0.20.3",
53
- "react-test-renderer": "18.0.0",
54
- "typescript": "^4.7.4"
51
+ "react": "18.2.0",
52
+ "react-native-builder-bob": "^0.20.4",
53
+ "react-test-renderer": "18.1.0",
54
+ "typescript": "^4.9.4"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "*"
@@ -70,5 +70,5 @@
70
70
  ]
71
71
  ]
72
72
  },
73
- "gitHead": "f2a05ec1634bc60302e9f6bd6cd2fb36083fb7c5"
73
+ "gitHead": "cf836cb84932638369f7bf59534d5a3ccea9b4f6"
74
74
  }
@@ -7,7 +7,7 @@ export default function checkDuplicateRouteNames(state: NavigationState) {
7
7
  location: string,
8
8
  state: NavigationState | PartialState<NavigationState>
9
9
  ) => {
10
- state.routes.forEach((route: typeof state.routes[0]) => {
10
+ state.routes.forEach((route: (typeof state.routes)[0]) => {
11
11
  const currentLocation = location
12
12
  ? `${location} > ${route.name}`
13
13
  : route.name;
@@ -9,7 +9,7 @@ import fromEntries from './fromEntries';
9
9
  import type { PathConfig, PathConfigMap } from './types';
10
10
  import validatePathConfig from './validatePathConfig';
11
11
 
12
- type Options<ParamList> = {
12
+ type Options<ParamList extends {}> = {
13
13
  initialRouteName?: string;
14
14
  screens: PathConfigMap<ParamList>;
15
15
  };
package/src/types.tsx CHANGED
@@ -702,7 +702,7 @@ export type PathConfig<ParamList extends {}> = {
702
702
  export type PathConfigMap<ParamList extends {}> = {
703
703
  [RouteName in keyof ParamList]?: NonNullable<
704
704
  ParamList[RouteName]
705
- > extends NavigatorScreenParams<infer T, any>
705
+ > extends NavigatorScreenParams<infer T extends {}>
706
706
  ? string | PathConfig<T>
707
707
  : string | Omit<PathConfig<{}>, 'screens' | 'initialRouteName'>;
708
708
  };
@@ -177,6 +177,7 @@ export default function useDescriptors<
177
177
  (acc, curr) =>
178
178
  Object.assign(
179
179
  acc,
180
+ // @ts-expect-error: we check for function but TS still complains
180
181
  typeof curr !== 'function' ? curr : curr({ route, navigation })
181
182
  ),
182
183
  {} as ScreenOptions
@@ -153,7 +153,12 @@ const getRouteConfigsFromChildren = <
153
153
  ? `'${
154
154
  typeof child.type === 'string' ? child.type : child.type?.name
155
155
  }'${
156
- child.props?.name ? ` for the screen '${child.props.name}'` : ''
156
+ child.props != null &&
157
+ typeof child.props === 'object' &&
158
+ 'name' in child.props &&
159
+ child.props?.name
160
+ ? ` for the screen '${child.props.name}'`
161
+ : ''
157
162
  }`
158
163
  : typeof child === 'object'
159
164
  ? JSON.stringify(child)