@react-navigation/routers 7.5.3 → 8.0.0-alpha.1
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/BaseRouter.js +19 -1
- package/lib/module/BaseRouter.js.map +1 -1
- package/lib/module/CommonActions.js +9 -24
- package/lib/module/CommonActions.js.map +1 -1
- package/lib/module/DrawerRouter.js +0 -1
- package/lib/module/DrawerRouter.js.map +1 -1
- package/lib/module/StackRouter.js +58 -72
- package/lib/module/StackRouter.js.map +1 -1
- package/lib/module/TabRouter.js +18 -28
- package/lib/module/TabRouter.js.map +1 -1
- package/lib/typescript/src/BaseRouter.d.ts +0 -9
- package/lib/typescript/src/BaseRouter.d.ts.map +1 -1
- package/lib/typescript/src/CommonActions.d.ts +15 -15
- package/lib/typescript/src/CommonActions.d.ts.map +1 -1
- package/lib/typescript/src/DrawerRouter.d.ts.map +1 -1
- package/lib/typescript/src/StackRouter.d.ts.map +1 -1
- package/lib/typescript/src/TabRouter.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +21 -4
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/BaseRouter.tsx +27 -1
- package/src/CommonActions.tsx +16 -43
- package/src/DrawerRouter.tsx +1 -2
- package/src/StackRouter.tsx +68 -94
- package/src/TabRouter.tsx +27 -37
- package/src/types.tsx +47 -29
package/src/types.tsx
CHANGED
|
@@ -64,35 +64,42 @@ export type PartialState<State extends NavigationState> = Partial<
|
|
|
64
64
|
|
|
65
65
|
export type Route<
|
|
66
66
|
RouteName extends string,
|
|
67
|
-
Params extends object | undefined = object | undefined,
|
|
68
|
-
> = Readonly<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
Params extends unknown | object | undefined = object | undefined,
|
|
68
|
+
> = Readonly<
|
|
69
|
+
{
|
|
70
|
+
/**
|
|
71
|
+
* Unique key for the route.
|
|
72
|
+
*/
|
|
73
|
+
key: string;
|
|
74
|
+
/**
|
|
75
|
+
* User-provided name for the route.
|
|
76
|
+
*/
|
|
77
|
+
name: RouteName;
|
|
78
|
+
/**
|
|
79
|
+
* Path associated with the route.
|
|
80
|
+
* Usually present when the screen was opened from a deep link.
|
|
81
|
+
*/
|
|
82
|
+
path?: string;
|
|
83
|
+
/**
|
|
84
|
+
* History of param changes for this route.
|
|
85
|
+
*/
|
|
86
|
+
history?: { type: 'params'; params: object }[];
|
|
87
|
+
} & Readonly<
|
|
88
|
+
undefined extends Params
|
|
89
|
+
? {
|
|
90
|
+
/**
|
|
91
|
+
* Params for this route
|
|
92
|
+
*/
|
|
93
|
+
params?: Readonly<Params>;
|
|
94
|
+
}
|
|
95
|
+
: {
|
|
96
|
+
/**
|
|
97
|
+
* Params for this route
|
|
98
|
+
*/
|
|
99
|
+
params: Readonly<Params>;
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
>;
|
|
96
103
|
|
|
97
104
|
export type ParamListBase = Record<string, object | undefined>;
|
|
98
105
|
|
|
@@ -221,6 +228,17 @@ export type Router<
|
|
|
221
228
|
*/
|
|
222
229
|
shouldActionChangeFocus(action: NavigationAction): boolean;
|
|
223
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Get the list of routes from the navigation state.
|
|
233
|
+
*
|
|
234
|
+
* By default, `state.routes` is used.
|
|
235
|
+
* But in some cases (like `preloadedRoutes` in stack),
|
|
236
|
+
* the actual list of routes may be different.
|
|
237
|
+
*
|
|
238
|
+
* @param state Navigation state to get the routes from.
|
|
239
|
+
*/
|
|
240
|
+
getRoutesFromState?(state: State): Route<string>[];
|
|
241
|
+
|
|
224
242
|
/**
|
|
225
243
|
* Action creators for the router.
|
|
226
244
|
*/
|