@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/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
- * Unique key for the route.
71
- */
72
- key: string;
73
- /**
74
- * User-provided name for the route.
75
- */
76
- name: RouteName;
77
- /**
78
- * Path associated with the route.
79
- * Usually present when the screen was opened from a deep link.
80
- */
81
- path?: string;
82
- }> &
83
- (undefined extends Params
84
- ? Readonly<{
85
- /**
86
- * Params for this route
87
- */
88
- params?: Readonly<Params>;
89
- }>
90
- : Readonly<{
91
- /**
92
- * Params for this route
93
- */
94
- params: Readonly<Params>;
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
  */