@react-navigation/core 8.0.0-alpha.19 → 8.0.0-alpha.20
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.
- package/lib/module/BaseNavigationContainer.js +6 -2
- package/lib/module/BaseNavigationContainer.js.map +1 -1
- package/lib/module/StaticNavigation.js +72 -61
- package/lib/module/StaticNavigation.js.map +1 -1
- package/lib/module/findFocusedRoute.js +7 -4
- package/lib/module/findFocusedRoute.js.map +1 -1
- package/lib/module/getActionFromState.js +25 -12
- package/lib/module/getActionFromState.js.map +1 -1
- package/lib/module/getPathFromState.js +24 -9
- package/lib/module/getPathFromState.js.map +1 -1
- package/lib/module/getPatternParts.js +3 -0
- package/lib/module/getPatternParts.js.map +1 -1
- package/lib/module/getStateFromPath.js +164 -78
- package/lib/module/getStateFromPath.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +8 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/useDescriptors.js +13 -6
- package/lib/module/useDescriptors.js.map +1 -1
- package/lib/module/useFocusEvents.js +5 -1
- package/lib/module/useFocusEvents.js.map +1 -1
- package/lib/module/useNavigation.js.map +1 -1
- package/lib/module/useNavigationBuilder.js +18 -5
- package/lib/module/useNavigationBuilder.js.map +1 -1
- package/lib/module/useNavigationCache.js +1 -1
- package/lib/module/useNavigationCache.js.map +1 -1
- package/lib/module/useNavigationState.js.map +1 -1
- package/lib/module/useOnAction.js +1 -1
- package/lib/module/useOnAction.js.map +1 -1
- package/lib/module/useRoute.js.map +1 -1
- package/lib/module/validatePathConfig.js +2 -1
- package/lib/module/validatePathConfig.js.map +1 -1
- package/lib/typescript/src/BaseNavigationContainer.d.ts +2 -2
- package/lib/typescript/src/BaseNavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/EnsureSingleNavigator.d.ts +1 -1
- package/lib/typescript/src/EnsureSingleNavigator.d.ts.map +1 -1
- package/lib/typescript/src/Group.d.ts +1 -1
- package/lib/typescript/src/Group.d.ts.map +1 -1
- package/lib/typescript/src/NavigationBuilderContext.d.ts +1 -1
- package/lib/typescript/src/NavigationBuilderContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainerRefContext.d.ts +1 -1
- package/lib/typescript/src/NavigationContainerRefContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationHelpersContext.d.ts +1 -1
- package/lib/typescript/src/NavigationHelpersContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationIndependentTree.d.ts +1 -1
- package/lib/typescript/src/NavigationIndependentTree.d.ts.map +1 -1
- package/lib/typescript/src/NavigationProvider.d.ts +6 -6
- package/lib/typescript/src/NavigationProvider.d.ts.map +1 -1
- package/lib/typescript/src/PreventRemoveProvider.d.ts +1 -1
- package/lib/typescript/src/PreventRemoveProvider.d.ts.map +1 -1
- package/lib/typescript/src/SceneView.d.ts +3 -2
- package/lib/typescript/src/SceneView.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts +1 -1
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/StaticNavigation.d.ts +68 -73
- package/lib/typescript/src/StaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/createNavigationContainerRef.d.ts +1 -1
- package/lib/typescript/src/createNavigationContainerRef.d.ts.map +1 -1
- package/lib/typescript/src/createNavigatorFactory.d.ts +3 -3
- package/lib/typescript/src/createNavigatorFactory.d.ts.map +1 -1
- package/lib/typescript/src/findFocusedRoute.d.ts.map +1 -1
- package/lib/typescript/src/getActionFromState.d.ts +1 -1
- package/lib/typescript/src/getActionFromState.d.ts.map +1 -1
- package/lib/typescript/src/getPathFromState.d.ts +1 -1
- package/lib/typescript/src/getPathFromState.d.ts.map +1 -1
- package/lib/typescript/src/getPatternParts.d.ts +1 -0
- package/lib/typescript/src/getPatternParts.d.ts.map +1 -1
- package/lib/typescript/src/getStateFromPath.d.ts +2 -2
- package/lib/typescript/src/getStateFromPath.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +34 -33
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theming/ThemeContext.d.ts +1 -1
- package/lib/typescript/src/theming/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/src/theming/ThemeProvider.d.ts +2 -2
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/theming/useTheme.d.ts +1 -1
- package/lib/typescript/src/theming/useTheme.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +72 -37
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useChildListeners.d.ts +3 -3
- package/lib/typescript/src/useChildListeners.d.ts.map +1 -1
- package/lib/typescript/src/useComponent.d.ts +1 -1
- package/lib/typescript/src/useComponent.d.ts.map +1 -1
- package/lib/typescript/src/useDescriptors.d.ts +5 -5
- package/lib/typescript/src/useDescriptors.d.ts.map +1 -1
- package/lib/typescript/src/useEventEmitter.d.ts +1 -1
- package/lib/typescript/src/useEventEmitter.d.ts.map +1 -1
- package/lib/typescript/src/useFocusEvents.d.ts +2 -2
- package/lib/typescript/src/useFocusEvents.d.ts.map +1 -1
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts +2 -2
- package/lib/typescript/src/useFocusedListenersChildrenAdapter.d.ts.map +1 -1
- package/lib/typescript/src/useKeyedChildListeners.d.ts +3 -3
- package/lib/typescript/src/useKeyedChildListeners.d.ts.map +1 -1
- package/lib/typescript/src/useNavigation.d.ts +5 -3
- package/lib/typescript/src/useNavigation.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationBuilder.d.ts +7 -7
- package/lib/typescript/src/useNavigationBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationCache.d.ts +3 -3
- package/lib/typescript/src/useNavigationCache.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationContainerRef.d.ts +1 -1
- package/lib/typescript/src/useNavigationContainerRef.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationHelpers.d.ts +4 -4
- package/lib/typescript/src/useNavigationHelpers.d.ts.map +1 -1
- package/lib/typescript/src/useNavigationState.d.ts +2 -2
- package/lib/typescript/src/useNavigationState.d.ts.map +1 -1
- package/lib/typescript/src/useOnAction.d.ts +3 -3
- package/lib/typescript/src/useOnAction.d.ts.map +1 -1
- package/lib/typescript/src/useOnGetState.d.ts +1 -1
- package/lib/typescript/src/useOnGetState.d.ts.map +1 -1
- package/lib/typescript/src/useOnPreventRemove.d.ts +3 -3
- package/lib/typescript/src/useOnPreventRemove.d.ts.map +1 -1
- package/lib/typescript/src/useOptionsGetters.d.ts +1 -1
- package/lib/typescript/src/useOptionsGetters.d.ts.map +1 -1
- package/lib/typescript/src/usePreventRemoveContext.d.ts +1 -1
- package/lib/typescript/src/useRoute.d.ts +2 -2
- package/lib/typescript/src/useRoute.d.ts.map +1 -1
- package/lib/typescript/src/useRouteCache.d.ts +2 -2
- package/lib/typescript/src/useRouteCache.d.ts.map +1 -1
- package/lib/typescript/src/useStateForPath.d.ts +1 -1
- package/lib/typescript/src/useStateForPath.d.ts.map +1 -1
- package/lib/typescript/src/utilities.d.ts +4 -3
- package/lib/typescript/src/utilities.d.ts.map +1 -1
- package/lib/typescript/src/validatePathConfig.d.ts.map +1 -1
- package/package.json +18 -17
- package/src/BaseNavigationContainer.tsx +7 -2
- package/src/StaticNavigation.tsx +220 -248
- package/src/findFocusedRoute.tsx +10 -5
- package/src/getActionFromState.tsx +43 -30
- package/src/getPathFromState.tsx +40 -20
- package/src/getPatternParts.tsx +8 -0
- package/src/getStateFromPath.tsx +244 -67
- package/src/index.tsx +39 -1
- package/src/types.tsx +167 -122
- package/src/useDescriptors.tsx +22 -10
- package/src/useFocusEvents.tsx +7 -1
- package/src/useNavigation.tsx +8 -4
- package/src/useNavigationBuilder.tsx +22 -7
- package/src/useNavigationCache.tsx +4 -4
- package/src/useNavigationState.tsx +3 -3
- package/src/useOnAction.tsx +1 -1
- package/src/useRoute.tsx +4 -2
- package/src/utilities.tsx +17 -11
- package/src/validatePathConfig.tsx +1 -0
package/src/useRoute.tsx
CHANGED
|
@@ -22,8 +22,10 @@ type AllRouteNames<ParamList extends {}> = RouteForName<
|
|
|
22
22
|
*/
|
|
23
23
|
export function useRoute<
|
|
24
24
|
const ParamList extends {} = RootParamList,
|
|
25
|
-
const RouteName extends
|
|
26
|
-
>(
|
|
25
|
+
const RouteName extends string = string,
|
|
26
|
+
>(
|
|
27
|
+
name: RouteName & AllRouteNames<ParamList>
|
|
28
|
+
): RouteForName<ParamList, RouteName>;
|
|
27
29
|
export function useRoute<
|
|
28
30
|
const ParamList extends {} = RootParamList,
|
|
29
31
|
>(): {} extends ParamList
|
package/src/utilities.tsx
CHANGED
|
@@ -121,17 +121,23 @@ export type ExtractParamsType<Params, Parse> = {
|
|
|
121
121
|
? R
|
|
122
122
|
: Params[K]
|
|
123
123
|
: Params[K];
|
|
124
|
-
} &
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
} & // Query params are the parse keys not present in the path pattern. When there
|
|
125
|
+
// are none (the common case), skip building the query param mapped types.
|
|
126
|
+
([Exclude<keyof Parse, keyof Params>] extends [never]
|
|
127
|
+
? {}
|
|
128
|
+
: {
|
|
129
|
+
/**
|
|
130
|
+
* Optional param types not in path pattern (for query params)
|
|
131
|
+
*/
|
|
132
|
+
[K in QueryParamOptionalKeys<Params, Parse>]?: QueryParamValue<
|
|
133
|
+
Parse[K]
|
|
134
|
+
>;
|
|
135
|
+
} & {
|
|
136
|
+
/**
|
|
137
|
+
* Required param types not in path pattern (for query params)
|
|
138
|
+
*/
|
|
139
|
+
[K in QueryParamRequiredKeys<Params, Parse>]: QueryParamValue<Parse[K]>;
|
|
140
|
+
});
|
|
135
141
|
|
|
136
142
|
type QueryParamValue<ParseValue> =
|
|
137
143
|
ParseValue extends StandardSchemaV1<unknown, infer R>
|