@amazon-devices/react-navigation__routers 8.0.9000000000 → 8.0.9000000002
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/SystemModules/amzn__react-navigation__routers-8.private.modules.txt +9 -0
- package/kepler-compatibility.json +4 -2
- package/lib/module/StackRouter.js.map +1 -1
- package/lib/module/index.js +0 -9
- package/lib/typescript/src/StackRouter.d.ts +19 -13
- package/lib/typescript/src/StackRouter.d.ts.map +1 -1
- package/oss-attribution/attribution.txt +0 -0
- package/oss-attribution/licenseInfos.json +1 -0
- package/package.json +1 -1
- package/src/index.tsx +0 -27
- package/SystemBundles/21657b0b773752468bbe6711df32d141e12a1ad993b6abbe39ad0de460714386.bundle +0 -1279
- package/SystemBundles/21657b0b773752468bbe6711df32d141e12a1ad993b6abbe39ad0de460714386.map +0 -372
- package/lib/module/BaseRouter.js +0 -57
- package/lib/module/CommonActions.js +0 -85
- package/lib/module/DrawerRouter.js +0 -145
- package/lib/module/StackRouter.js +0 -465
- package/lib/module/TabRouter.js +0 -328
- package/lib/module/createParamsFromAction.js +0 -16
- package/lib/module/createRouteFromAction.js +0 -21
- package/lib/module/types.js +0 -4
- package/src/BaseRouter.tsx +0 -86
- package/src/CommonActions.tsx +0 -180
- package/src/DrawerRouter.tsx +0 -249
- package/src/StackRouter.tsx +0 -709
- package/src/TabRouter.tsx +0 -546
- package/src/createParamsFromAction.tsx +0 -22
- package/src/createRouteFromAction.tsx +0 -24
- package/src/types.tsx +0 -228
package/src/types.tsx
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import type * as CommonActions from './CommonActions';
|
|
2
|
-
|
|
3
|
-
export type CommonNavigationAction = CommonActions.Action;
|
|
4
|
-
|
|
5
|
-
export type NavigationRoute<
|
|
6
|
-
ParamList extends ParamListBase,
|
|
7
|
-
RouteName extends keyof ParamList,
|
|
8
|
-
> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {
|
|
9
|
-
state?: NavigationState | PartialState<NavigationState>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type NavigationState<ParamList extends ParamListBase = ParamListBase> =
|
|
13
|
-
Readonly<{
|
|
14
|
-
/**
|
|
15
|
-
* Unique key for the navigation state.
|
|
16
|
-
*/
|
|
17
|
-
key: string;
|
|
18
|
-
/**
|
|
19
|
-
* Index of the currently focused route.
|
|
20
|
-
*/
|
|
21
|
-
index: number;
|
|
22
|
-
/**
|
|
23
|
-
* List of valid route names as defined in the screen components.
|
|
24
|
-
*/
|
|
25
|
-
routeNames: Extract<keyof ParamList, string>[];
|
|
26
|
-
/**
|
|
27
|
-
* Alternative entries for history.
|
|
28
|
-
*/
|
|
29
|
-
history?: unknown[];
|
|
30
|
-
/**
|
|
31
|
-
* List of rendered routes.
|
|
32
|
-
*/
|
|
33
|
-
routes: NavigationRoute<ParamList, keyof ParamList>[];
|
|
34
|
-
/**
|
|
35
|
-
* Custom type for the state, whether it's for tab, stack, drawer etc.
|
|
36
|
-
* During rehydration, the state will be discarded if type doesn't match with router type.
|
|
37
|
-
* It can also be used to detect the type of the navigator we're dealing with.
|
|
38
|
-
*/
|
|
39
|
-
type: string;
|
|
40
|
-
/**
|
|
41
|
-
* Whether the navigation state has been rehydrated.
|
|
42
|
-
*/
|
|
43
|
-
stale: false;
|
|
44
|
-
}>;
|
|
45
|
-
|
|
46
|
-
export type InitialState = Readonly<
|
|
47
|
-
Partial<Omit<NavigationState, 'stale' | 'routes'>> & {
|
|
48
|
-
routes: (Omit<Route<string>, 'key'> & { state?: InitialState })[];
|
|
49
|
-
}
|
|
50
|
-
>;
|
|
51
|
-
|
|
52
|
-
export type PartialRoute<R extends Route<string>> = Omit<R, 'key'> & {
|
|
53
|
-
key?: string;
|
|
54
|
-
state?: PartialState<NavigationState>;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type PartialState<State extends NavigationState> = Partial<
|
|
58
|
-
Omit<State, 'stale' | 'routes'>
|
|
59
|
-
> &
|
|
60
|
-
Readonly<{
|
|
61
|
-
stale?: true;
|
|
62
|
-
routes: PartialRoute<Route<State['routeNames'][number]>>[];
|
|
63
|
-
}>;
|
|
64
|
-
|
|
65
|
-
export type Route<
|
|
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
|
-
}>);
|
|
96
|
-
|
|
97
|
-
export type ParamListBase = Record<string, object | undefined>;
|
|
98
|
-
|
|
99
|
-
export type NavigationAction = Readonly<{
|
|
100
|
-
/**
|
|
101
|
-
* Type of the action (e.g. `NAVIGATE`)
|
|
102
|
-
*/
|
|
103
|
-
type: string;
|
|
104
|
-
/**
|
|
105
|
-
* Additional data for the action
|
|
106
|
-
*/
|
|
107
|
-
payload?: object;
|
|
108
|
-
/**
|
|
109
|
-
* Key of the route which dispatched this action.
|
|
110
|
-
*/
|
|
111
|
-
source?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Key of the navigator which should handle this action.
|
|
114
|
-
*/
|
|
115
|
-
target?: string;
|
|
116
|
-
}>;
|
|
117
|
-
|
|
118
|
-
export type ActionCreators<Action extends NavigationAction> = {
|
|
119
|
-
[key: string]: (...args: any) => Action;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export type DefaultRouterOptions<RouteName extends string = string> = {
|
|
123
|
-
/**
|
|
124
|
-
* Name of the route to focus by on initial render.
|
|
125
|
-
* If not specified, usually the first route is used.
|
|
126
|
-
*/
|
|
127
|
-
initialRouteName?: RouteName;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export type RouterFactory<
|
|
131
|
-
State extends NavigationState,
|
|
132
|
-
Action extends NavigationAction,
|
|
133
|
-
RouterOptions extends DefaultRouterOptions,
|
|
134
|
-
> = (options: RouterOptions) => Router<State, Action>;
|
|
135
|
-
|
|
136
|
-
export type RouterConfigOptions = {
|
|
137
|
-
routeNames: string[];
|
|
138
|
-
routeParamList: ParamListBase;
|
|
139
|
-
routeGetIdList: Record<
|
|
140
|
-
string,
|
|
141
|
-
| ((options: { params?: Record<string, any> }) => string | undefined)
|
|
142
|
-
| undefined
|
|
143
|
-
>;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export type Router<
|
|
147
|
-
State extends NavigationState,
|
|
148
|
-
Action extends NavigationAction,
|
|
149
|
-
> = {
|
|
150
|
-
/**
|
|
151
|
-
* Type of the router. Should match the `type` property in state.
|
|
152
|
-
* If the type doesn't match, the state will be discarded during rehydration.
|
|
153
|
-
*/
|
|
154
|
-
type: State['type'];
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Initialize the navigation state.
|
|
158
|
-
*
|
|
159
|
-
* @param options.routeNames List of valid route names as defined in the screen components.
|
|
160
|
-
* @param options.routeParamsList Object containing params for each route.
|
|
161
|
-
*/
|
|
162
|
-
getInitialState(options: RouterConfigOptions): State;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Rehydrate the full navigation state from a given partial state.
|
|
166
|
-
*
|
|
167
|
-
* @param partialState Navigation state to rehydrate from.
|
|
168
|
-
* @param options.routeNames List of valid route names as defined in the screen components.
|
|
169
|
-
* @param options.routeParamsList Object containing params for each route.
|
|
170
|
-
*/
|
|
171
|
-
getRehydratedState(
|
|
172
|
-
partialState: PartialState<State> | State,
|
|
173
|
-
options: RouterConfigOptions
|
|
174
|
-
): State;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Take the current state and updated list of route names, and return a new state.
|
|
178
|
-
*
|
|
179
|
-
* @param state State object to update.
|
|
180
|
-
* @param options.routeNames New list of route names.
|
|
181
|
-
* @param options.routeParamsList Object containing params for each route.
|
|
182
|
-
*/
|
|
183
|
-
getStateForRouteNamesChange(
|
|
184
|
-
state: State,
|
|
185
|
-
options: RouterConfigOptions & {
|
|
186
|
-
/**
|
|
187
|
-
* List of routes whose key has changed even if they still have the same name.
|
|
188
|
-
* This allows to remove screens declaratively.
|
|
189
|
-
*/
|
|
190
|
-
routeKeyChanges: string[];
|
|
191
|
-
}
|
|
192
|
-
): State;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Take the current state and key of a route, and return a new state with the route focused
|
|
196
|
-
*
|
|
197
|
-
* @param state State object to apply the action on.
|
|
198
|
-
* @param key Key of the route to focus.
|
|
199
|
-
*/
|
|
200
|
-
getStateForRouteFocus(state: State, key: string): State;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Take the current state and action, and return a new state.
|
|
204
|
-
* If the action cannot be handled, return `null`.
|
|
205
|
-
*
|
|
206
|
-
* @param state State object to apply the action on.
|
|
207
|
-
* @param action Action object to apply.
|
|
208
|
-
* @param options.routeNames List of valid route names as defined in the screen components.
|
|
209
|
-
* @param options.routeParamsList Object containing params for each route.
|
|
210
|
-
*/
|
|
211
|
-
getStateForAction(
|
|
212
|
-
state: State,
|
|
213
|
-
action: Action,
|
|
214
|
-
options: RouterConfigOptions
|
|
215
|
-
): State | PartialState<State> | null;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Whether the action should also change focus in parent navigator
|
|
219
|
-
*
|
|
220
|
-
* @param action Action object to check.
|
|
221
|
-
*/
|
|
222
|
-
shouldActionChangeFocus(action: NavigationAction): boolean;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Action creators for the router.
|
|
226
|
-
*/
|
|
227
|
-
actionCreators?: ActionCreators<Action>;
|
|
228
|
-
};
|