@react-navigation/routers 6.1.8 → 7.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/README.md +1 -1
- package/lib/commonjs/BaseRouter.js +3 -4
- package/lib/commonjs/BaseRouter.js.map +1 -1
- package/lib/commonjs/CommonActions.js +23 -2
- package/lib/commonjs/CommonActions.js.map +1 -1
- package/lib/commonjs/DrawerRouter.js +4 -5
- package/lib/commonjs/DrawerRouter.js.map +1 -1
- package/lib/commonjs/StackRouter.js +129 -39
- package/lib/commonjs/StackRouter.js.map +1 -1
- package/lib/commonjs/TabRouter.js +9 -17
- package/lib/commonjs/TabRouter.js.map +1 -1
- package/lib/commonjs/index.js +8 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/BaseRouter.js +2 -3
- package/lib/module/BaseRouter.js.map +1 -1
- package/lib/module/CommonActions.js +22 -2
- package/lib/module/CommonActions.js.map +1 -1
- package/lib/module/DrawerRouter.js +3 -2
- package/lib/module/DrawerRouter.js.map +1 -1
- package/lib/module/StackRouter.js +127 -36
- package/lib/module/StackRouter.js.map +1 -1
- package/lib/module/TabRouter.js +7 -14
- package/lib/module/TabRouter.js.map +1 -1
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/BaseRouter.d.ts +1 -2
- package/lib/typescript/src/BaseRouter.d.ts.map +1 -1
- package/lib/typescript/src/CommonActions.d.ts +13 -13
- package/lib/typescript/src/CommonActions.d.ts.map +1 -1
- package/lib/typescript/src/DrawerRouter.d.ts +6 -6
- package/lib/typescript/src/DrawerRouter.d.ts.map +1 -1
- package/lib/typescript/src/StackRouter.d.ts +24 -6
- package/lib/typescript/src/StackRouter.d.ts.map +1 -1
- package/lib/typescript/src/TabRouter.d.ts +6 -6
- package/lib/typescript/src/TabRouter.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -4
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +14 -14
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/BaseRouter.tsx +2 -4
- package/src/CommonActions.tsx +48 -28
- package/src/DrawerRouter.tsx +5 -3
- package/src/StackRouter.tsx +272 -149
- package/src/TabRouter.tsx +11 -21
- package/src/index.tsx +4 -4
|
@@ -3,7 +3,7 @@ import type { CommonNavigationAction, PartialState } from './types';
|
|
|
3
3
|
* Base router object that can be used when writing custom routers.
|
|
4
4
|
* This provides few helper methods to handle common actions such as `RESET`.
|
|
5
5
|
*/
|
|
6
|
-
declare const BaseRouter: {
|
|
6
|
+
export declare const BaseRouter: {
|
|
7
7
|
getStateForAction<State extends Readonly<{
|
|
8
8
|
key: string;
|
|
9
9
|
index: number;
|
|
@@ -23,5 +23,4 @@ declare const BaseRouter: {
|
|
|
23
23
|
}>>(state: State, action: CommonNavigationAction): State | PartialState<State> | null;
|
|
24
24
|
shouldActionChangeFocus(action: CommonNavigationAction): boolean;
|
|
25
25
|
};
|
|
26
|
-
export default BaseRouter;
|
|
27
26
|
//# sourceMappingURL=BaseRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseRouter.d.ts","sourceRoot":"","sources":["../../../src/BaseRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EAEtB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"BaseRouter.d.ts","sourceRoot":"","sources":["../../../src/BaseRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,sBAAsB,EAEtB,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;8BAGX,sBAAsB;oCA4DA,sBAAsB;CAGvD,CAAC"}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import type { NavigationState, PartialState, Route } from './types';
|
|
2
|
-
|
|
2
|
+
type ResetState = PartialState<NavigationState> | NavigationState | (Omit<NavigationState, 'routes'> & {
|
|
3
3
|
routes: Omit<Route<string>, 'key'>[];
|
|
4
4
|
});
|
|
5
|
-
export
|
|
5
|
+
export type Action = {
|
|
6
6
|
type: 'GO_BACK';
|
|
7
7
|
source?: string;
|
|
8
8
|
target?: string;
|
|
9
9
|
} | {
|
|
10
10
|
type: 'NAVIGATE';
|
|
11
11
|
payload: {
|
|
12
|
-
|
|
13
|
-
name?: undefined;
|
|
12
|
+
name: string;
|
|
14
13
|
params?: object;
|
|
15
14
|
path?: string;
|
|
16
15
|
merge?: boolean;
|
|
17
|
-
}
|
|
16
|
+
};
|
|
17
|
+
source?: string;
|
|
18
|
+
target?: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'NAVIGATE_DEPRECATED';
|
|
21
|
+
payload: {
|
|
18
22
|
name: string;
|
|
19
|
-
key?: string;
|
|
20
23
|
params?: object;
|
|
21
|
-
path?: string;
|
|
22
24
|
merge?: boolean;
|
|
23
25
|
};
|
|
24
26
|
source?: string;
|
|
@@ -38,18 +40,16 @@ export declare type Action = {
|
|
|
38
40
|
};
|
|
39
41
|
export declare function goBack(): Action;
|
|
40
42
|
export declare function navigate(options: {
|
|
41
|
-
key: string;
|
|
42
|
-
params?: object;
|
|
43
|
-
path?: string;
|
|
44
|
-
merge?: boolean;
|
|
45
|
-
} | {
|
|
46
43
|
name: string;
|
|
47
|
-
key?: string;
|
|
48
44
|
params?: object;
|
|
49
45
|
path?: string;
|
|
50
46
|
merge?: boolean;
|
|
51
47
|
}): Action;
|
|
52
48
|
export declare function navigate(name: string, params?: object): Action;
|
|
49
|
+
export declare function navigateDeprecated(...args: [name: string] | [name: string, params: object | undefined] | [route: {
|
|
50
|
+
name: string;
|
|
51
|
+
params?: object;
|
|
52
|
+
}]): Action;
|
|
53
53
|
export declare function reset(state: ResetState | undefined): Action;
|
|
54
54
|
export declare function setParams(params: object): Action;
|
|
55
55
|
export {};
|
|
@@ -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,SAAS,CAAC;AAEpE,
|
|
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,SAAS,CAAC;AAEpE,KAAK,UAAU,GACX,YAAY,CAAC,eAAe,CAAC,GAC7B,eAAe,GACf,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,GAAG;IACjC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;CACtC,CAAC,CAAC;AAEP,MAAM,MAAM,MAAM,GACd;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,wBAAgB,MAAM,IAAI,MAAM,CAE/B;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,MAAM,CAAC;AAEX,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;AAkBhE,wBAAgB,kBAAkB,CAChC,GAAG,IAAI,EACH,CAAC,IAAI,EAAE,MAAM,CAAC,GACd,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC1C,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7C,MAAM,CAiBR;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,CAE3D;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TabActionHelpers, TabActionType, TabNavigationState, TabRouterOptions } from './TabRouter';
|
|
2
2
|
import type { CommonNavigationAction, ParamListBase, Router } from './types';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type DrawerStatus = 'open' | 'closed';
|
|
4
|
+
export type DrawerActionType = TabActionType | {
|
|
5
5
|
type: 'OPEN_DRAWER' | 'CLOSE_DRAWER' | 'TOGGLE_DRAWER';
|
|
6
6
|
source?: string;
|
|
7
7
|
target?: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type DrawerRouterOptions = TabRouterOptions & {
|
|
10
10
|
defaultStatus?: DrawerStatus;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type DrawerNavigationState<ParamList extends ParamListBase> = Omit<TabNavigationState<ParamList>, 'type' | 'history'> & {
|
|
13
13
|
/**
|
|
14
14
|
* Type of the router, in this case, it's drawer.
|
|
15
15
|
*/
|
|
@@ -29,7 +29,7 @@ export declare type DrawerNavigationState<ParamList extends ParamListBase> = Omi
|
|
|
29
29
|
status: DrawerStatus;
|
|
30
30
|
})[];
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type DrawerActionHelpers<ParamList extends ParamListBase> = TabActionHelpers<ParamList> & {
|
|
33
33
|
/**
|
|
34
34
|
* Open the drawer sidebar.
|
|
35
35
|
*/
|
|
@@ -49,5 +49,5 @@ export declare const DrawerActions: {
|
|
|
49
49
|
toggleDrawer(): DrawerActionType;
|
|
50
50
|
jumpTo(name: string, params?: object | undefined): TabActionType;
|
|
51
51
|
};
|
|
52
|
-
export
|
|
52
|
+
export declare function DrawerRouter({ defaultStatus, ...rest }: DrawerRouterOptions): Router<DrawerNavigationState<ParamListBase>, DrawerActionType | CommonNavigationAction>;
|
|
53
53
|
//# sourceMappingURL=DrawerRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerRouter.d.ts","sourceRoot":"","sources":["../../../src/DrawerRouter.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"DrawerRouter.d.ts","sourceRoot":"","sources":["../../../src/DrawerRouter.tsx"],"names":[],"mappings":"AA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,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,aAAwB,EACxB,GAAG,IAAI,EACR,EAAE,mBAAmB,GAAG,MAAM,CAC7B,qBAAqB,CAAC,aAAa,CAAC,EACpC,gBAAgB,GAAG,sBAAsB,CAC1C,CAgKA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { DefaultRouterOptions, NavigationState, ParamListBase, Router } from './types';
|
|
2
|
-
export
|
|
2
|
+
export type StackActionType = {
|
|
3
3
|
type: 'REPLACE';
|
|
4
4
|
payload: {
|
|
5
5
|
name: string;
|
|
6
|
-
key?: string | undefined;
|
|
7
6
|
params?: object;
|
|
8
7
|
};
|
|
9
8
|
source?: string;
|
|
@@ -27,15 +26,24 @@ export declare type StackActionType = {
|
|
|
27
26
|
type: 'POP_TO_TOP';
|
|
28
27
|
source?: string;
|
|
29
28
|
target?: string;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'POP_TO';
|
|
31
|
+
payload: {
|
|
32
|
+
name: string;
|
|
33
|
+
params?: object;
|
|
34
|
+
merge?: boolean;
|
|
35
|
+
};
|
|
36
|
+
source?: string;
|
|
37
|
+
target?: string;
|
|
30
38
|
};
|
|
31
|
-
export
|
|
32
|
-
export
|
|
39
|
+
export type StackRouterOptions = DefaultRouterOptions;
|
|
40
|
+
export type StackNavigationState<ParamList extends ParamListBase> = NavigationState<ParamList> & {
|
|
33
41
|
/**
|
|
34
42
|
* Type of the router, in this case, it's stack.
|
|
35
43
|
*/
|
|
36
44
|
type: 'stack';
|
|
37
45
|
};
|
|
38
|
-
export
|
|
46
|
+
export type StackActionHelpers<ParamList extends ParamListBase> = {
|
|
39
47
|
/**
|
|
40
48
|
* Replace the current route with a new one.
|
|
41
49
|
*
|
|
@@ -58,12 +66,22 @@ export declare type StackActionHelpers<ParamList extends ParamListBase> = {
|
|
|
58
66
|
* Pop to the first route in the stack, dismissing all other screens.
|
|
59
67
|
*/
|
|
60
68
|
popToTop(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Pop any screens to go back to the specified screen.
|
|
71
|
+
* If the specified screen doesn't exist, it'll be added to the stack.
|
|
72
|
+
*
|
|
73
|
+
* @param name Name of the route to navigate to.
|
|
74
|
+
* @param [params] Params object for the route.
|
|
75
|
+
* @param [merge] Whether to merge the params onto the route.
|
|
76
|
+
*/
|
|
77
|
+
popTo<RouteName extends keyof ParamList>(...args: RouteName extends unknown ? undefined extends ParamList[RouteName] ? [screen: RouteName] | [screen: RouteName, params: ParamList[RouteName]] | [screen: RouteName, params: ParamList[RouteName], merge: boolean] : [screen: RouteName, params: ParamList[RouteName]] | [screen: RouteName, params: ParamList[RouteName], merge: boolean] : never): void;
|
|
61
78
|
};
|
|
62
79
|
export declare const StackActions: {
|
|
63
80
|
replace(name: string, params?: object): StackActionType;
|
|
64
81
|
push(name: string, params?: object): StackActionType;
|
|
65
82
|
pop(count?: number): StackActionType;
|
|
66
83
|
popToTop(): StackActionType;
|
|
84
|
+
popTo(name: string, params?: object, merge?: boolean): StackActionType;
|
|
67
85
|
};
|
|
68
|
-
export
|
|
86
|
+
export declare function StackRouter(options: StackRouterOptions): Router<StackNavigationState<ParamListBase>, import("./CommonActions").Action | StackActionType>;
|
|
69
87
|
//# sourceMappingURL=StackRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StackRouter.d.ts","sourceRoot":"","sources":["../../../src/StackRouter.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAEb,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB,
|
|
1
|
+
{"version":3,"file":"StackRouter.d.ts","sourceRoot":"","sources":["../../../src/StackRouter.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAEb,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,eAAe,GACvB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OA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AO,CAAC,GACvE,KAAK,GACR,IAAI,CAAC;CACT,CAAC;AAEF,eAAO,MAAM,YAAY;kBACT,MAAM,WAAW,MAAM,GAAG,eAAe;eAG5C,MAAM,WAAW,MAAM,GAAG,eAAe;gBAGzC,MAAM,GAAO,eAAe;gBAG3B,eAAe;gBAGf,MAAM,WAAW,MAAM,UAAU,OAAO,GAAG,eAAe;CAGvE,CAAC;AAEF,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,mGAketD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DefaultRouterOptions, NavigationState, ParamListBase, Router } from './types';
|
|
2
|
-
export
|
|
2
|
+
export type TabActionType = {
|
|
3
3
|
type: 'JUMP_TO';
|
|
4
4
|
payload: {
|
|
5
5
|
name: string;
|
|
@@ -8,11 +8,11 @@ export declare type TabActionType = {
|
|
|
8
8
|
source?: string;
|
|
9
9
|
target?: string;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type BackBehavior = 'initialRoute' | 'firstRoute' | 'history' | 'order' | 'none';
|
|
12
|
+
export type TabRouterOptions = DefaultRouterOptions & {
|
|
13
13
|
backBehavior?: BackBehavior;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type TabNavigationState<ParamList extends ParamListBase> = Omit<NavigationState<ParamList>, 'history'> & {
|
|
16
16
|
/**
|
|
17
17
|
* Type of the router, in this case, it's tab.
|
|
18
18
|
*/
|
|
@@ -25,7 +25,7 @@ export declare type TabNavigationState<ParamList extends ParamListBase> = Omit<N
|
|
|
25
25
|
key: string;
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type TabActionHelpers<ParamList extends ParamListBase> = {
|
|
29
29
|
/**
|
|
30
30
|
* Jump to an existing tab.
|
|
31
31
|
*
|
|
@@ -37,5 +37,5 @@ export declare type TabActionHelpers<ParamList extends ParamListBase> = {
|
|
|
37
37
|
export declare const TabActions: {
|
|
38
38
|
jumpTo(name: string, params?: object): TabActionType;
|
|
39
39
|
};
|
|
40
|
-
export
|
|
40
|
+
export declare function TabRouter({ initialRouteName, backBehavior, }: TabRouterOptions): Router<TabNavigationState<ParamListBase>, import("./CommonActions").Action | TabActionType>;
|
|
41
41
|
//# sourceMappingURL=TabRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../../../src/TabRouter.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAGb,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB,
|
|
1
|
+
{"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../../../src/TabRouter.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,oBAAoB,EACpB,eAAe,EACf,aAAa,EAGb,MAAM,EACP,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,YAAY,GACZ,SAAS,GACT,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG;IACpD,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,SAAS,SAAS,aAAa,IAAI,IAAI,CACpE,eAAe,CAAC,SAAS,CAAC,EAC1B,SAAS,CACV,GAAG;IACF;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IACZ;;OAEG;IACH,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,SAAS,aAAa,IAAI;IAC9D;;;;;OAKG;IACH,MAAM,CAAC,SAAS,SAAS,OAAO,CAAC,MAAM,SAAS,EAAE,MAAM,CAAC,EACvD,GAAG,IAAI,EAAE,SAAS,SAAS,SAAS,CAAC,SAAS,CAAC,GAC3C,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GACvE,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GACpD,IAAI,CAAC;CACT,CAAC;AAIF,eAAO,MAAM,UAAU;iBACR,MAAM,WAAW,MAAM,GAAG,aAAa;CAGrD,CAAC;AA4EF,wBAAgB,SAAS,CAAC,EACxB,gBAAgB,EAChB,YAA2B,GAC5B,EAAE,gBAAgB,+FA4PlB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as CommonActions from './CommonActions';
|
|
2
2
|
export { CommonActions };
|
|
3
|
-
export {
|
|
3
|
+
export { BaseRouter } from './BaseRouter';
|
|
4
4
|
export type { DrawerActionHelpers, DrawerActionType, DrawerNavigationState, DrawerRouterOptions, DrawerStatus, } from './DrawerRouter';
|
|
5
|
-
export { DrawerActions,
|
|
5
|
+
export { DrawerActions, DrawerRouter } from './DrawerRouter';
|
|
6
6
|
export type { StackActionHelpers, StackActionType, StackNavigationState, StackRouterOptions, } from './StackRouter';
|
|
7
|
-
export { StackActions,
|
|
7
|
+
export { StackActions, StackRouter } from './StackRouter';
|
|
8
8
|
export type { TabActionHelpers, TabActionType, TabNavigationState, TabRouterOptions, } from './TabRouter';
|
|
9
|
-
export { TabActions,
|
|
9
|
+
export { TabActions, TabRouter } from './TabRouter';
|
|
10
10
|
export * from './types';
|
|
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,iBAAiB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpD,cAAc,SAAS,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as CommonActions from './CommonActions';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type CommonNavigationAction = CommonActions.Action;
|
|
3
|
+
type NavigationRoute<ParamList extends ParamListBase, RouteName extends keyof ParamList> = Route<Extract<RouteName, string>, ParamList[RouteName]> & {
|
|
4
4
|
state?: NavigationState | PartialState<NavigationState>;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type NavigationState<ParamList extends ParamListBase = ParamListBase> = Readonly<{
|
|
7
7
|
/**
|
|
8
8
|
* Unique key for the navigation state.
|
|
9
9
|
*/
|
|
@@ -35,20 +35,20 @@ export declare type NavigationState<ParamList extends ParamListBase = ParamListB
|
|
|
35
35
|
*/
|
|
36
36
|
stale: false;
|
|
37
37
|
}>;
|
|
38
|
-
export
|
|
38
|
+
export type InitialState = Readonly<Partial<Omit<NavigationState, 'stale' | 'routes'>> & {
|
|
39
39
|
routes: (Omit<Route<string>, 'key'> & {
|
|
40
40
|
state?: InitialState;
|
|
41
41
|
})[];
|
|
42
42
|
}>;
|
|
43
|
-
export
|
|
43
|
+
export type PartialRoute<R extends Route<string>> = Omit<R, 'key'> & {
|
|
44
44
|
key?: string;
|
|
45
45
|
state?: PartialState<NavigationState>;
|
|
46
46
|
};
|
|
47
|
-
export
|
|
47
|
+
export type PartialState<State extends NavigationState> = Partial<Omit<State, 'stale' | 'routes'>> & Readonly<{
|
|
48
48
|
stale?: true;
|
|
49
49
|
routes: PartialRoute<Route<State['routeNames'][number]>>[];
|
|
50
50
|
}>;
|
|
51
|
-
export
|
|
51
|
+
export type Route<RouteName extends string, Params extends object | undefined = object | undefined> = Readonly<{
|
|
52
52
|
/**
|
|
53
53
|
* Unique key for the route.
|
|
54
54
|
*/
|
|
@@ -73,8 +73,8 @@ export declare type Route<RouteName extends string, Params extends object | unde
|
|
|
73
73
|
*/
|
|
74
74
|
params: Readonly<Params>;
|
|
75
75
|
}>);
|
|
76
|
-
export
|
|
77
|
-
export
|
|
76
|
+
export type ParamListBase = Record<string, object | undefined>;
|
|
77
|
+
export type NavigationAction = Readonly<{
|
|
78
78
|
/**
|
|
79
79
|
* Type of the action (e.g. `NAVIGATE`)
|
|
80
80
|
*/
|
|
@@ -92,25 +92,25 @@ export declare type NavigationAction = Readonly<{
|
|
|
92
92
|
*/
|
|
93
93
|
target?: string;
|
|
94
94
|
}>;
|
|
95
|
-
export
|
|
95
|
+
export type ActionCreators<Action extends NavigationAction> = {
|
|
96
96
|
[key: string]: (...args: any) => Action;
|
|
97
97
|
};
|
|
98
|
-
export
|
|
98
|
+
export type DefaultRouterOptions<RouteName extends string = string> = {
|
|
99
99
|
/**
|
|
100
100
|
* Name of the route to focus by on initial render.
|
|
101
101
|
* If not specified, usually the first route is used.
|
|
102
102
|
*/
|
|
103
103
|
initialRouteName?: RouteName;
|
|
104
104
|
};
|
|
105
|
-
export
|
|
106
|
-
export
|
|
105
|
+
export type RouterFactory<State extends NavigationState, Action extends NavigationAction, RouterOptions extends DefaultRouterOptions> = (options: RouterOptions) => Router<State, Action>;
|
|
106
|
+
export type RouterConfigOptions = {
|
|
107
107
|
routeNames: string[];
|
|
108
108
|
routeParamList: ParamListBase;
|
|
109
109
|
routeGetIdList: Record<string, ((options: {
|
|
110
110
|
params?: Record<string, any>;
|
|
111
111
|
}) => string | undefined) | undefined>;
|
|
112
112
|
};
|
|
113
|
-
export
|
|
113
|
+
export type Router<State extends NavigationState, Action extends NavigationAction> = {
|
|
114
114
|
/**
|
|
115
115
|
* Type of the router. Should match the `type` property in state.
|
|
116
116
|
* If the type doesn't match, the state will be discarded during rehydration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,aAAa,MAAM,iBAAiB,CAAC;AAEtD,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,aAAa,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC,MAAM,CAAC;AAE1D,KAAK,eAAe,CAClB,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,C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,KAAK,CAAC,GAAG,IAAI,CAAC;IAEtC;;;;OAIG;IACH,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": "
|
|
4
|
+
"version": "7.0.0-alpha.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"react-native",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"nanoid": "^3.1.23"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"del-cli": "^
|
|
42
|
+
"del-cli": "^5.0.0",
|
|
43
43
|
"react-native-builder-bob": "^0.20.4",
|
|
44
|
-
"typescript": "^4.
|
|
44
|
+
"typescript": "^4.9.4"
|
|
45
45
|
},
|
|
46
46
|
"react-native-builder-bob": {
|
|
47
47
|
"source": "src",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
]
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "230c09deeeb886929a15cb4cdcb496372a9496e1"
|
|
61
61
|
}
|
package/src/BaseRouter.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
* Base router object that can be used when writing custom routers.
|
|
11
11
|
* This provides few helper methods to handle common actions such as `RESET`.
|
|
12
12
|
*/
|
|
13
|
-
const BaseRouter = {
|
|
13
|
+
export const BaseRouter = {
|
|
14
14
|
getStateForAction<State extends NavigationState>(
|
|
15
15
|
state: State,
|
|
16
16
|
action: CommonNavigationAction
|
|
@@ -74,8 +74,6 @@ const BaseRouter = {
|
|
|
74
74
|
},
|
|
75
75
|
|
|
76
76
|
shouldActionChangeFocus(action: CommonNavigationAction) {
|
|
77
|
-
return action.type === 'NAVIGATE';
|
|
77
|
+
return action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED';
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
|
-
|
|
81
|
-
export default BaseRouter;
|
package/src/CommonActions.tsx
CHANGED
|
@@ -15,21 +15,22 @@ export type Action =
|
|
|
15
15
|
}
|
|
16
16
|
| {
|
|
17
17
|
type: 'NAVIGATE';
|
|
18
|
-
payload:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
payload: {
|
|
19
|
+
name: string;
|
|
20
|
+
params?: object;
|
|
21
|
+
path?: string;
|
|
22
|
+
merge?: boolean;
|
|
23
|
+
};
|
|
24
|
+
source?: string;
|
|
25
|
+
target?: string;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
type: 'NAVIGATE_DEPRECATED';
|
|
29
|
+
payload: {
|
|
30
|
+
name: string;
|
|
31
|
+
params?: object;
|
|
32
|
+
merge?: boolean;
|
|
33
|
+
};
|
|
33
34
|
source?: string;
|
|
34
35
|
target?: string;
|
|
35
36
|
}
|
|
@@ -50,17 +51,12 @@ export function goBack(): Action {
|
|
|
50
51
|
return { type: 'GO_BACK' };
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
export function navigate(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
params?: object;
|
|
60
|
-
path?: string;
|
|
61
|
-
merge?: boolean;
|
|
62
|
-
}
|
|
63
|
-
): Action;
|
|
54
|
+
export function navigate(options: {
|
|
55
|
+
name: string;
|
|
56
|
+
params?: object;
|
|
57
|
+
path?: string;
|
|
58
|
+
merge?: boolean;
|
|
59
|
+
}): Action;
|
|
64
60
|
// eslint-disable-next-line no-redeclare
|
|
65
61
|
export function navigate(name: string, params?: object): Action;
|
|
66
62
|
// eslint-disable-next-line no-redeclare
|
|
@@ -70,9 +66,9 @@ export function navigate(...args: any): Action {
|
|
|
70
66
|
} else {
|
|
71
67
|
const payload = args[0] || {};
|
|
72
68
|
|
|
73
|
-
if (!payload.hasOwnProperty('
|
|
69
|
+
if (!payload.hasOwnProperty('name')) {
|
|
74
70
|
throw new Error(
|
|
75
|
-
'You need to specify name
|
|
71
|
+
'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.'
|
|
76
72
|
);
|
|
77
73
|
}
|
|
78
74
|
|
|
@@ -80,6 +76,30 @@ export function navigate(...args: any): Action {
|
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
|
|
79
|
+
export function navigateDeprecated(
|
|
80
|
+
...args:
|
|
81
|
+
| [name: string]
|
|
82
|
+
| [name: string, params: object | undefined]
|
|
83
|
+
| [route: { name: string; params?: object }]
|
|
84
|
+
): Action {
|
|
85
|
+
if (typeof args[0] === 'string') {
|
|
86
|
+
return {
|
|
87
|
+
type: 'NAVIGATE_DEPRECATED',
|
|
88
|
+
payload: { name: args[0], params: args[1] },
|
|
89
|
+
};
|
|
90
|
+
} else {
|
|
91
|
+
const payload = args[0] || {};
|
|
92
|
+
|
|
93
|
+
if (!payload.hasOwnProperty('name')) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
'You need to specify a name when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigatelegacy for usage.'
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return { type: 'NAVIGATE_DEPRECATED', payload };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
83
103
|
export function reset(state: ResetState | undefined): Action {
|
|
84
104
|
return { type: 'RESET', payload: state };
|
|
85
105
|
}
|
package/src/DrawerRouter.tsx
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { nanoid } from 'nanoid/non-secure';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
4
|
TabActionHelpers,
|
|
5
5
|
TabActions,
|
|
6
6
|
TabActionType,
|
|
7
7
|
TabNavigationState,
|
|
8
|
+
TabRouter,
|
|
8
9
|
TabRouterOptions,
|
|
9
10
|
} from './TabRouter';
|
|
10
11
|
import type {
|
|
@@ -79,7 +80,7 @@ export const DrawerActions = {
|
|
|
79
80
|
},
|
|
80
81
|
};
|
|
81
82
|
|
|
82
|
-
export
|
|
83
|
+
export function DrawerRouter({
|
|
83
84
|
defaultStatus = 'closed',
|
|
84
85
|
...rest
|
|
85
86
|
}: DrawerRouterOptions): Router<
|
|
@@ -220,7 +221,8 @@ export default function DrawerRouter({
|
|
|
220
221
|
return addDrawerToHistory(state);
|
|
221
222
|
|
|
222
223
|
case 'JUMP_TO':
|
|
223
|
-
case 'NAVIGATE':
|
|
224
|
+
case 'NAVIGATE':
|
|
225
|
+
case 'NAVIGATE_DEPRECATED': {
|
|
224
226
|
const result = router.getStateForAction(state, action, options);
|
|
225
227
|
|
|
226
228
|
if (result != null && result.index !== state.index) {
|