@react-navigation/routers 8.0.0-alpha.10 → 8.0.0-alpha.12
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/CommonActions.js +9 -21
- package/lib/module/CommonActions.js.map +1 -1
- package/lib/module/StackRouter.js +91 -23
- package/lib/module/StackRouter.js.map +1 -1
- package/lib/module/TabRouter.js +52 -11
- package/lib/module/TabRouter.js.map +1 -1
- package/lib/typescript/src/BaseRouter.d.ts +1 -1
- package/lib/typescript/src/BaseRouter.d.ts.map +1 -1
- package/lib/typescript/src/CommonActions.d.ts +1 -8
- package/lib/typescript/src/CommonActions.d.ts.map +1 -1
- package/lib/typescript/src/DrawerRouter.d.ts +2 -2
- package/lib/typescript/src/DrawerRouter.d.ts.map +1 -1
- package/lib/typescript/src/StackRouter.d.ts +2 -2
- package/lib/typescript/src/StackRouter.d.ts.map +1 -1
- package/lib/typescript/src/TabRouter.d.ts +2 -2
- package/lib/typescript/src/TabRouter.d.ts.map +1 -1
- package/lib/typescript/src/createParamsFromAction.d.ts +1 -1
- package/lib/typescript/src/createParamsFromAction.d.ts.map +1 -1
- package/lib/typescript/src/createRouteFromAction.d.ts +1 -1
- package/lib/typescript/src/createRouteFromAction.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +9 -9
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +3 -3
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/CommonActions.tsx +10 -34
- package/src/StackRouter.tsx +129 -17
- package/src/TabRouter.tsx +75 -14
- package/src/types.tsx +13 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonActions.d.ts","sourceRoot":"","sources":["../../../src/CommonActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CommonActions.d.ts","s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,OAAO,GAAG,SAAS,CAAC;CAC3B,GACD,SAAS,GACZ,MAAM,CAUR;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU;;;EAEtC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM;;;;;EAKvC;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM;;;;;EAK3C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM;;;;;EAKxC;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS;;;;;;EAKhE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type TabActionHelpers, type TabActionType, type TabNavigationState, type TabRouterOptions } from './TabRouter';
|
|
2
|
-
import type { CommonNavigationAction, ParamListBase, Router } from './types';
|
|
1
|
+
import { type TabActionHelpers, type TabActionType, type TabNavigationState, type TabRouterOptions } from './TabRouter.js';
|
|
2
|
+
import type { CommonNavigationAction, ParamListBase, Router } from './types.js';
|
|
3
3
|
export type DrawerStatus = 'open' | 'closed';
|
|
4
4
|
export type DrawerActionType = TabActionType | {
|
|
5
5
|
type: 'OPEN_DRAWER' | 'CLOSE_DRAWER' | 'TOGGLE_DRAWER';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerRouter.d.ts","sourceRoot":"","sources":["../../../src/DrawerRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"DrawerRouter.d.ts","sourceRoot":"","sources":["../../../src/DrawerRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EACtB,MAAM,gBAAa,CAAC;AACrB,OAAO,KAAK,EACV,sBAA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BAAqB,CAAC,aAAa,CAAC,EACpC,gBAAgB,GAAG,sBAAsB,CAC1C,CA+JA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultRouterOptions, NavigationState, ParamListBase, Router } from './types';
|
|
1
|
+
import type { DefaultRouterOptions, NavigationState, ParamListBase, Router } from './types.js';
|
|
2
2
|
export type StackActionType = {
|
|
3
3
|
type: 'REPLACE';
|
|
4
4
|
payload: {
|
|
@@ -150,5 +150,5 @@ export declare const StackActions: {
|
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
};
|
|
153
|
-
export declare function StackRouter(options: StackRouterOptions): Router<StackNavigationState<ParamListBase>, import("./CommonActions").Action | StackActionType>;
|
|
153
|
+
export declare function StackRouter(options: StackRouterOptions): Router<StackNavigationState<ParamListBase>, import("./CommonActions.js").Action | StackActionType>;
|
|
154
154
|
//# sourceMappingURL=StackRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackRouter.d.ts","sourceRoot":"","sources":["../../../src/StackRouter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAEb,MAAM,EACP,MAAM,
|
|
1
|
+
{"version":3,"file":"StackRouter.d.ts","sourceRoot":"","sources":["../../../src/StackRouter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAEb,MAAM,EACP,MAAM,YAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IACvD,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,GACD;IACE,IAAI,EAAE,MAAM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AS;QACjB,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC;QAC5B,OAAO,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE;KAC9B,GACH,KAAK,GACR,IAAI,CAAC;IAER;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,YAAY;kBACT,MAAM,WAAW,MAAM;;;;;;;eAM1B,MAAM,WAAW,MAAM;;;;;;;gBAMvB,MAAM;;;;;;;;;gBASL,MAAM,WAAW,MAAM,YAAY;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;;;;;;;;mBAUnD,OAAO;;;;;;CAMvB,CAAC;AA6FF,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,sGAsxBtD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultRouterOptions, NavigationState, ParamListBase, Router } from './types';
|
|
1
|
+
import type { DefaultRouterOptions, NavigationState, ParamListBase, Router } from './types.js';
|
|
2
2
|
export type TabActionType = {
|
|
3
3
|
type: 'JUMP_TO';
|
|
4
4
|
payload: {
|
|
@@ -57,5 +57,5 @@ export declare const TabActions: {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
-
export declare function TabRouter({ initialRouteName, backBehavior, }: TabRouterOptions): Router<TabNavigationState<ParamListBase>, import("./CommonActions").Action | TabActionType>;
|
|
60
|
+
export declare function TabRouter({ initialRouteName, backBehavior, }: TabRouterOptions): Router<TabNavigationState<ParamListBase>, import("./CommonActions.js").Action | TabActionType>;
|
|
61
61
|
//# sourceMappingURL=TabRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../../../src/TabRouter.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAGb,MAAM,EACP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SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,GACpC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GAClD,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GACnD,KAAK,GACR,IAAI,CAAC;CACT,CAAC;AAIF,eAAO,MAAM,UAAU;iBACR,MAAM,WAAW,MAAM;;;;;;;CAMrC,CAAC;AA2IF,wBAAgB,SAAS,CAAC,EACxB,gBAAgB,EAChB,YAA2B,GAC5B,EAAE,gBAAgB,kGAiXlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createParamsFromAction.d.ts","sourceRoot":"","sources":["../../../src/createParamsFromAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createParamsFromAction.d.ts","sourceRoot":"","sources":["../../../src/createParamsFromAction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAS,CAAC;AAE7C,KAAK,OAAO,GAAG;IACb,MAAM,EAAE;QACN,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;SAC7B,CAAC;KACH,CAAC;IACF,cAAc,EAAE,aAAa,CAAC;CAC/B,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,OAAO,sBASzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRouteFromAction.d.ts","sourceRoot":"","sources":["../../../src/createRouteFromAction.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createRouteFromAction.d.ts","sourceRoot":"","sources":["../../../src/createRouteFromAction.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAS,CAAC;AAE7C,KAAK,OAAO,GAAG;IACb,MAAM,EAAE;QACN,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;SAC7B,CAAC;KACH,CAAC;IACF,cAAc,EAAE,aAAa,CAAC;CAC/B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,OAAO;;;;EAQxE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as CommonActions from './CommonActions';
|
|
1
|
+
import * as CommonActions from './CommonActions.js';
|
|
2
2
|
export { CommonActions };
|
|
3
|
-
export { BaseRouter } from './BaseRouter';
|
|
4
|
-
export type { DrawerActionHelpers, DrawerActionType, DrawerNavigationState, DrawerRouterOptions, DrawerStatus, } from './DrawerRouter';
|
|
5
|
-
export { DrawerActions, DrawerRouter } from './DrawerRouter';
|
|
6
|
-
export type { StackActionHelpers, StackActionType, StackNavigationState, StackRouterOptions, } from './StackRouter';
|
|
7
|
-
export { StackActions, StackRouter } from './StackRouter';
|
|
8
|
-
export type { TabActionHelpers, TabActionType, TabNavigationState, TabRouterOptions, } from './TabRouter';
|
|
9
|
-
export { TabActions, TabRouter } from './TabRouter';
|
|
10
|
-
export * from './types';
|
|
3
|
+
export { BaseRouter } from './BaseRouter.js';
|
|
4
|
+
export type { DrawerActionHelpers, DrawerActionType, DrawerNavigationState, DrawerRouterOptions, DrawerStatus, } from './DrawerRouter.js';
|
|
5
|
+
export { DrawerActions, DrawerRouter } from './DrawerRouter.js';
|
|
6
|
+
export type { StackActionHelpers, StackActionType, StackNavigationState, StackRouterOptions, } from './StackRouter.js';
|
|
7
|
+
export { StackActions, StackRouter } from './StackRouter.js';
|
|
8
|
+
export type { TabActionHelpers, TabActionType, TabNavigationState, TabRouterOptions, } from './TabRouter.js';
|
|
9
|
+
export { TabActions, TabRouter } from './TabRouter.js';
|
|
10
|
+
export * from './types.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,oBAAiB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAc,CAAC;AAC1C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AAC7D,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kBAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AAC1D,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,gBAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAa,CAAC;AACpD,cAAc,YAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as CommonActions from './CommonActions';
|
|
1
|
+
import type * as CommonActions from './CommonActions.js';
|
|
2
2
|
export type CommonNavigationAction = CommonActions.Action;
|
|
3
3
|
export type NavigationRoute<ParamList extends ParamListBase, RouteName extends keyof ParamList> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {
|
|
4
4
|
state?: NavigationState | PartialState<NavigationState> | undefined;
|
|
@@ -69,7 +69,7 @@ export type Route<RouteName extends string, Params extends unknown | object | un
|
|
|
69
69
|
type: 'params';
|
|
70
70
|
params: object;
|
|
71
71
|
}[] | undefined;
|
|
72
|
-
} &
|
|
72
|
+
} & (undefined extends Params ? {
|
|
73
73
|
/**
|
|
74
74
|
* Params for this route
|
|
75
75
|
*/
|
|
@@ -79,7 +79,7 @@ export type Route<RouteName extends string, Params extends unknown | object | un
|
|
|
79
79
|
* Params for this route
|
|
80
80
|
*/
|
|
81
81
|
params: Readonly<Params>;
|
|
82
|
-
}
|
|
82
|
+
})>;
|
|
83
83
|
export type ParamListBase = Record<string, object | undefined>;
|
|
84
84
|
export type NavigationAction = Readonly<{
|
|
85
85
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,aAAa,MAAM,oBAAiB,CAAC;AAEtD,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC,MAAM,CAAC;AAE1D,MAAM,MAAM,eAAe,CACzB,SAAS,SAAS,aAAa,EAC/B,SAAS,SAAS,MAAM,SAAS,IAC/B,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG;IAC5D,KAAK,CAAC,EAAE,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,aAAa,GAAG,aAAa,IACzE,QAAQ,CAAC;IACP;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC,MAAM,SAAS,EAAE,MAAM,CAAC,EAAE,C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uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAE3D;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;CACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/routers",
|
|
3
3
|
"description": "Routers to help build custom navigators",
|
|
4
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"version": "8.0.0-alpha.12",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"react-native",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"clean": "del lib"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"nanoid": "^5.1.
|
|
44
|
+
"nanoid": "^5.1.11"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@jest/globals": "^
|
|
47
|
+
"@jest/globals": "^29.7.0",
|
|
48
48
|
"del-cli": "^7.0.0",
|
|
49
|
-
"react-native-builder-bob": "^0.
|
|
50
|
-
"typescript": "^6.0.
|
|
49
|
+
"react-native-builder-bob": "^0.42.1",
|
|
50
|
+
"typescript": "^6.0.3"
|
|
51
51
|
},
|
|
52
52
|
"react-native-builder-bob": {
|
|
53
53
|
"source": "src",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
]
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b18e1874297bb41bb0dc048b25b4dbc02cb5af50"
|
|
71
71
|
}
|
package/src/CommonActions.tsx
CHANGED
|
@@ -86,40 +86,16 @@ export function navigate(
|
|
|
86
86
|
pop?: boolean | undefined;
|
|
87
87
|
}
|
|
88
88
|
| undefined
|
|
89
|
-
): Action
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function navigate(...args: any): Action {
|
|
100
|
-
if (typeof args[0] === 'string') {
|
|
101
|
-
const [name, params, options] = args;
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
type: 'NAVIGATE',
|
|
105
|
-
payload: {
|
|
106
|
-
name,
|
|
107
|
-
params,
|
|
108
|
-
merge: options?.merge,
|
|
109
|
-
pop: options?.pop,
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
} else {
|
|
113
|
-
const payload = args[0] || {};
|
|
114
|
-
|
|
115
|
-
if (!('name' in payload)) {
|
|
116
|
-
throw new Error(
|
|
117
|
-
'You need to specify a name when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.'
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return { type: 'NAVIGATE', payload };
|
|
122
|
-
}
|
|
89
|
+
): Action {
|
|
90
|
+
return {
|
|
91
|
+
type: 'NAVIGATE',
|
|
92
|
+
payload: {
|
|
93
|
+
name,
|
|
94
|
+
params,
|
|
95
|
+
merge: options?.merge,
|
|
96
|
+
pop: options?.pop,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
123
99
|
}
|
|
124
100
|
|
|
125
101
|
export function reset(state: ResetState) {
|
package/src/StackRouter.tsx
CHANGED
|
@@ -289,6 +289,12 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
289
289
|
? options.initialRouteName
|
|
290
290
|
: routeNames[0];
|
|
291
291
|
|
|
292
|
+
if (initialRouteName == null) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
"Couldn't initialize the stack navigator. Have you defined any screens?"
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
292
298
|
return {
|
|
293
299
|
stale: false,
|
|
294
300
|
type: 'stack',
|
|
@@ -333,6 +339,12 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
333
339
|
? options.initialRouteName
|
|
334
340
|
: routeNames[0];
|
|
335
341
|
|
|
342
|
+
if (initialRouteName == null) {
|
|
343
|
+
throw new Error(
|
|
344
|
+
"Couldn't initialize the stack navigator. Have you defined any screens?"
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
336
348
|
routes.push({
|
|
337
349
|
key: `${initialRouteName}-${nanoid()}`,
|
|
338
350
|
name: initialRouteName,
|
|
@@ -389,6 +401,12 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
389
401
|
? options.initialRouteName
|
|
390
402
|
: routeNames[0];
|
|
391
403
|
|
|
404
|
+
if (initialRouteName == null) {
|
|
405
|
+
throw new Error(
|
|
406
|
+
"Couldn't initialize the stack navigator. Have you defined any screens?"
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
392
410
|
routes.push({
|
|
393
411
|
key: `${initialRouteName}-${nanoid()}`,
|
|
394
412
|
name: initialRouteName,
|
|
@@ -498,6 +516,10 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
498
516
|
if (action.type === 'NAVIGATE') {
|
|
499
517
|
const currentRoute = routes[state.index];
|
|
500
518
|
|
|
519
|
+
if (currentRoute == null) {
|
|
520
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
521
|
+
}
|
|
522
|
+
|
|
501
523
|
if (id !== undefined) {
|
|
502
524
|
if (
|
|
503
525
|
currentRoute.name === action.payload.name &&
|
|
@@ -508,6 +530,10 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
508
530
|
for (let i = routes.length - 1; i >= 0; i--) {
|
|
509
531
|
const r = routes[i];
|
|
510
532
|
|
|
533
|
+
if (r == null) {
|
|
534
|
+
throw new Error(`Couldn't find a route at index ${i}.`);
|
|
535
|
+
}
|
|
536
|
+
|
|
511
537
|
if (r.name !== action.payload.name) {
|
|
512
538
|
continue;
|
|
513
539
|
}
|
|
@@ -519,13 +545,21 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
519
545
|
|
|
520
546
|
if (r.history?.length) {
|
|
521
547
|
for (let j = r.history.length - 1; j >= 0; j--) {
|
|
548
|
+
const historyEntry = r.history[j];
|
|
549
|
+
|
|
550
|
+
if (historyEntry == null) {
|
|
551
|
+
throw new Error(
|
|
552
|
+
`Couldn't find a route history entry at index ${j}.`
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
|
|
522
556
|
if (
|
|
523
|
-
|
|
524
|
-
id === getId?.({ params:
|
|
557
|
+
historyEntry.type === 'params' &&
|
|
558
|
+
id === getId?.({ params: historyEntry.params })
|
|
525
559
|
) {
|
|
526
560
|
route = {
|
|
527
561
|
...r,
|
|
528
|
-
params:
|
|
562
|
+
params: historyEntry.params,
|
|
529
563
|
history: r.history.slice(0, j),
|
|
530
564
|
};
|
|
531
565
|
break;
|
|
@@ -632,14 +666,20 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
632
666
|
];
|
|
633
667
|
}
|
|
634
668
|
|
|
669
|
+
const lastRoute = nextRoutes[nextRoutes.length - 1];
|
|
670
|
+
|
|
671
|
+
if (lastRoute == null) {
|
|
672
|
+
throw new Error(
|
|
673
|
+
`Couldn't find a route at index ${nextRoutes.length - 1}.`
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
|
|
635
677
|
return retainRoutes(
|
|
636
678
|
state,
|
|
637
679
|
getStateWithRoutes(
|
|
638
680
|
state,
|
|
639
681
|
nextRoutes,
|
|
640
|
-
preloadedRoutes.filter(
|
|
641
|
-
(route) => nextRoutes[nextRoutes.length - 1].key !== route.key
|
|
642
|
-
)
|
|
682
|
+
preloadedRoutes.filter((route) => lastRoute.key !== route.key)
|
|
643
683
|
)
|
|
644
684
|
);
|
|
645
685
|
}
|
|
@@ -656,6 +696,10 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
656
696
|
|
|
657
697
|
let route = routes[currentIndex];
|
|
658
698
|
|
|
699
|
+
if (route == null) {
|
|
700
|
+
throw new Error(`Couldn't find a route at index ${currentIndex}.`);
|
|
701
|
+
}
|
|
702
|
+
|
|
659
703
|
/**
|
|
660
704
|
* When popping entries,
|
|
661
705
|
* - Pop entries from route.history
|
|
@@ -699,7 +743,16 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
699
743
|
|
|
700
744
|
count = count - removed;
|
|
701
745
|
currentIndex = nextRoutes.length - 1;
|
|
702
|
-
|
|
746
|
+
|
|
747
|
+
const currentRoute = nextRoutes[currentIndex];
|
|
748
|
+
|
|
749
|
+
if (currentRoute == null) {
|
|
750
|
+
throw new Error(
|
|
751
|
+
`Couldn't find a route at index ${currentIndex}.`
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
route = currentRoute;
|
|
703
756
|
}
|
|
704
757
|
}
|
|
705
758
|
|
|
@@ -712,6 +765,10 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
712
765
|
case 'POP_TO_TOP': {
|
|
713
766
|
let route = routes[0];
|
|
714
767
|
|
|
768
|
+
if (route == null) {
|
|
769
|
+
throw new Error("Couldn't find a route at index 0.");
|
|
770
|
+
}
|
|
771
|
+
|
|
715
772
|
if (state.index > 0 || route.history?.length) {
|
|
716
773
|
if (route.history?.length) {
|
|
717
774
|
route = {
|
|
@@ -751,6 +808,10 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
751
808
|
for (let i = currentIndex; i >= 0; i--) {
|
|
752
809
|
const r = routes[i];
|
|
753
810
|
|
|
811
|
+
if (r == null) {
|
|
812
|
+
throw new Error(`Couldn't find a route at index ${i}.`);
|
|
813
|
+
}
|
|
814
|
+
|
|
754
815
|
if (r.name !== action.payload.name) {
|
|
755
816
|
continue;
|
|
756
817
|
}
|
|
@@ -762,9 +823,17 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
762
823
|
|
|
763
824
|
if (r.history?.length) {
|
|
764
825
|
for (let j = r.history.length - 1; j >= 0; j--) {
|
|
826
|
+
const historyEntry = r.history[j];
|
|
827
|
+
|
|
828
|
+
if (historyEntry == null) {
|
|
829
|
+
throw new Error(
|
|
830
|
+
`Couldn't find a route history entry at index ${j}.`
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
|
|
765
834
|
if (
|
|
766
|
-
|
|
767
|
-
id === getId?.({ params:
|
|
835
|
+
historyEntry.type === 'params' &&
|
|
836
|
+
id === getId?.({ params: historyEntry.params })
|
|
768
837
|
) {
|
|
769
838
|
index = i;
|
|
770
839
|
historyIndex = j;
|
|
@@ -777,11 +846,29 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
777
846
|
}
|
|
778
847
|
}
|
|
779
848
|
}
|
|
780
|
-
} else if (routes[currentIndex].name === action.payload.name) {
|
|
781
|
-
index = currentIndex;
|
|
782
849
|
} else {
|
|
850
|
+
const currentRoute = routes[currentIndex];
|
|
851
|
+
|
|
852
|
+
if (currentRoute == null) {
|
|
853
|
+
throw new Error(
|
|
854
|
+
`Couldn't find a route at index ${currentIndex}.`
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
if (currentRoute.name === action.payload.name) {
|
|
859
|
+
index = currentIndex;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
if (id == null && index === -1) {
|
|
783
864
|
for (let i = currentIndex; i >= 0; i--) {
|
|
784
|
-
|
|
865
|
+
const route = routes[i];
|
|
866
|
+
|
|
867
|
+
if (route == null) {
|
|
868
|
+
throw new Error(`Couldn't find a route at index ${i}.`);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
if (route.name === action.payload.name) {
|
|
785
872
|
index = i;
|
|
786
873
|
break;
|
|
787
874
|
}
|
|
@@ -821,11 +908,23 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
821
908
|
|
|
822
909
|
const route = routes[index];
|
|
823
910
|
|
|
911
|
+
if (route == null) {
|
|
912
|
+
throw new Error(`Couldn't find a route at index ${index}.`);
|
|
913
|
+
}
|
|
914
|
+
|
|
824
915
|
let baseParams = route.params;
|
|
825
916
|
let history = route.history;
|
|
826
917
|
|
|
827
918
|
if (historyIndex !== undefined && route.history) {
|
|
828
|
-
|
|
919
|
+
const historyEntry = route.history[historyIndex];
|
|
920
|
+
|
|
921
|
+
if (historyEntry == null) {
|
|
922
|
+
throw new Error(
|
|
923
|
+
`Couldn't find a route history entry at index ${historyIndex}.`
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
baseParams = historyEntry.params;
|
|
829
928
|
history = route.history.slice(0, historyIndex);
|
|
830
929
|
}
|
|
831
930
|
|
|
@@ -851,13 +950,19 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
851
950
|
...routes.slice(0, index),
|
|
852
951
|
params !== baseParams || historyIndex !== undefined
|
|
853
952
|
? { ...route, params, history }
|
|
854
|
-
:
|
|
953
|
+
: route,
|
|
855
954
|
])
|
|
856
955
|
);
|
|
857
956
|
}
|
|
858
957
|
|
|
859
|
-
case 'GO_BACK':
|
|
860
|
-
|
|
958
|
+
case 'GO_BACK': {
|
|
959
|
+
const route = routes[state.index];
|
|
960
|
+
|
|
961
|
+
if (route == null) {
|
|
962
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
if (state.index > 0 || route.history?.length) {
|
|
861
966
|
return router.getStateForAction(
|
|
862
967
|
state,
|
|
863
968
|
{
|
|
@@ -871,9 +976,16 @@ export function StackRouter(options: StackRouterOptions) {
|
|
|
871
976
|
}
|
|
872
977
|
|
|
873
978
|
return null;
|
|
979
|
+
}
|
|
874
980
|
|
|
875
981
|
case 'RETAIN': {
|
|
876
|
-
const
|
|
982
|
+
const route = routes[state.index];
|
|
983
|
+
|
|
984
|
+
if (route == null) {
|
|
985
|
+
throw new Error(`Couldn't find a route at index ${state.index}.`);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
const routeKey = action.source ?? route.key;
|
|
877
989
|
|
|
878
990
|
if (!state.routes.some((route) => route.key === routeKey)) {
|
|
879
991
|
return null;
|