@react-navigation/native 7.1.26 → 7.1.27
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/useLinkBuilder.js +25 -6
- package/lib/module/useLinkBuilder.js.map +1 -1
- package/lib/module/useLinkTo.js +2 -4
- package/lib/module/useLinkTo.js.map +1 -1
- package/lib/typescript/src/useLinkBuilder.d.ts +98 -0
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/useLinkBuilder.tsx +27 -7
- package/src/useLinkTo.tsx +2 -2
|
@@ -4,11 +4,9 @@ import { CommonActions, findFocusedRoute, getActionFromState, getPathFromState,
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { LinkingContext } from "./LinkingContext.js";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
|
|
7
|
+
* Helper to build a href for a screen based on the linking options.
|
|
10
8
|
*/
|
|
11
|
-
export function
|
|
9
|
+
export function useBuildHref() {
|
|
12
10
|
const navigation = React.useContext(NavigationHelpersContext);
|
|
13
11
|
const route = React.useContext(NavigationRouteContext);
|
|
14
12
|
const {
|
|
@@ -16,8 +14,6 @@ export function useLinkBuilder() {
|
|
|
16
14
|
} = React.useContext(LinkingContext);
|
|
17
15
|
const focusedRouteState = useStateForPath();
|
|
18
16
|
const getPathFromStateHelper = options?.getPathFromState ?? getPathFromState;
|
|
19
|
-
const getStateFromPathHelper = options?.getStateFromPath ?? getStateFromPath;
|
|
20
|
-
const getActionFromStateHelper = options?.getActionFromState ?? getActionFromState;
|
|
21
17
|
const buildHref = React.useCallback((name, params) => {
|
|
22
18
|
if (options?.enabled === false) {
|
|
23
19
|
return undefined;
|
|
@@ -65,6 +61,18 @@ export function useLinkBuilder() {
|
|
|
65
61
|
const path = getPathFromStateHelper(state, options?.config);
|
|
66
62
|
return path;
|
|
67
63
|
}, [options?.enabled, options?.config, route?.key, navigation, focusedRouteState, getPathFromStateHelper]);
|
|
64
|
+
return buildHref;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Helper to build a navigation action from a href based on the linking options.
|
|
69
|
+
*/
|
|
70
|
+
export const useBuildAction = () => {
|
|
71
|
+
const {
|
|
72
|
+
options
|
|
73
|
+
} = React.useContext(LinkingContext);
|
|
74
|
+
const getStateFromPathHelper = options?.getStateFromPath ?? getStateFromPath;
|
|
75
|
+
const getActionFromStateHelper = options?.getActionFromState ?? getActionFromState;
|
|
68
76
|
const buildAction = React.useCallback(href => {
|
|
69
77
|
if (!href.startsWith('/')) {
|
|
70
78
|
throw new Error(`The href must start with '/' (${href}).`);
|
|
@@ -77,6 +85,17 @@ export function useLinkBuilder() {
|
|
|
77
85
|
throw new Error('Failed to parse the href to a navigation state.');
|
|
78
86
|
}
|
|
79
87
|
}, [options?.config, getStateFromPathHelper, getActionFromStateHelper]);
|
|
88
|
+
return buildAction;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Helpers to build href or action based on the linking options.
|
|
93
|
+
*
|
|
94
|
+
* @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
|
|
95
|
+
*/
|
|
96
|
+
export function useLinkBuilder() {
|
|
97
|
+
const buildHref = useBuildHref();
|
|
98
|
+
const buildAction = useBuildAction();
|
|
80
99
|
return {
|
|
81
100
|
buildHref,
|
|
82
101
|
buildAction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CommonActions","findFocusedRoute","getActionFromState","getPathFromState","getStateFromPath","NavigationHelpersContext","NavigationRouteContext","useStateForPath","React","LinkingContext","
|
|
1
|
+
{"version":3,"names":["CommonActions","findFocusedRoute","getActionFromState","getPathFromState","getStateFromPath","NavigationHelpersContext","NavigationRouteContext","useStateForPath","React","LinkingContext","useBuildHref","navigation","useContext","route","options","focusedRouteState","getPathFromStateHelper","buildHref","useCallback","name","params","enabled","undefined","isScreen","key","getState","routes","some","r","stateForRoute","constructState","state","path","config","useBuildAction","getStateFromPathHelper","getActionFromStateHelper","buildAction","href","startsWith","Error","action","reset","useLinkBuilder"],"sourceRoot":"../../src","sources":["useLinkBuilder.tsx"],"mappings":"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","ignoreList":[]}
|
package/lib/module/useLinkTo.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { NavigationContainerRefContext } from '@react-navigation/core';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useBuildAction } from "./useLinkBuilder.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Helper to navigate to a screen using a href based on the linking options.
|
|
@@ -11,9 +11,7 @@ import { useLinkBuilder } from "./useLinkBuilder.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export function useLinkTo() {
|
|
13
13
|
const navigation = React.useContext(NavigationContainerRefContext);
|
|
14
|
-
const
|
|
15
|
-
buildAction
|
|
16
|
-
} = useLinkBuilder();
|
|
14
|
+
const buildAction = useBuildAction();
|
|
17
15
|
const linkTo = React.useCallback(href => {
|
|
18
16
|
if (navigation === undefined) {
|
|
19
17
|
throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NavigationContainerRefContext","React","
|
|
1
|
+
{"version":3,"names":["NavigationContainerRefContext","React","useBuildAction","useLinkTo","navigation","useContext","buildAction","linkTo","useCallback","href","undefined","Error","action","dispatch"],"sourceRoot":"../../src","sources":["useLinkTo.tsx"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,wBAAwB;AACtE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAE9B,SAASC,cAAc,QAAQ,qBAAkB;;AAEjD;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAA,EAAG;EAC1B,MAAMC,UAAU,GAAGH,KAAK,CAACI,UAAU,CAACL,6BAA6B,CAAC;EAClE,MAAMM,WAAW,GAAGJ,cAAc,CAAC,CAAC;EAEpC,MAAMK,MAAM,GAAGN,KAAK,CAACO,WAAW,CAC7BC,IAAY,IAAK;IAChB,IAAIL,UAAU,KAAKM,SAAS,EAAE;MAC5B,MAAM,IAAIC,KAAK,CACb,kFACF,CAAC;IACH;IAEA,MAAMC,MAAM,GAAGN,WAAW,CAACG,IAAI,CAAC;IAEhCL,UAAU,CAACS,QAAQ,CAACD,MAAM,CAAC;EAC7B,CAAC,EACD,CAACN,WAAW,EAAEF,UAAU,CAC1B,CAAC;EAED,OAAOG,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,3 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper to build a href for a screen based on the linking options.
|
|
3
|
+
*/
|
|
4
|
+
export declare function useBuildHref(): (name: string, params?: object) => string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Helper to build a navigation action from a href based on the linking options.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useBuildAction: () => (href: string) => {
|
|
9
|
+
type: "NAVIGATE";
|
|
10
|
+
payload: {
|
|
11
|
+
name: string;
|
|
12
|
+
params?: import("@react-navigation/core").NavigatorScreenParams<Readonly<{
|
|
13
|
+
key: string;
|
|
14
|
+
index: number;
|
|
15
|
+
routeNames: string[];
|
|
16
|
+
history?: unknown[];
|
|
17
|
+
routes: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>[];
|
|
18
|
+
type: string;
|
|
19
|
+
stale: false;
|
|
20
|
+
}>>;
|
|
21
|
+
path?: string;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
type: "GO_BACK";
|
|
25
|
+
source?: string;
|
|
26
|
+
target?: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "NAVIGATE";
|
|
29
|
+
payload: {
|
|
30
|
+
name: string;
|
|
31
|
+
params?: object;
|
|
32
|
+
path?: string;
|
|
33
|
+
merge?: boolean;
|
|
34
|
+
pop?: boolean;
|
|
35
|
+
};
|
|
36
|
+
source?: string;
|
|
37
|
+
target?: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: "NAVIGATE_DEPRECATED";
|
|
40
|
+
payload: {
|
|
41
|
+
name: string;
|
|
42
|
+
params?: object;
|
|
43
|
+
merge?: boolean;
|
|
44
|
+
};
|
|
45
|
+
source?: string;
|
|
46
|
+
target?: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: "SET_PARAMS";
|
|
49
|
+
payload: {
|
|
50
|
+
params?: object;
|
|
51
|
+
};
|
|
52
|
+
source?: string;
|
|
53
|
+
target?: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: "REPLACE_PARAMS";
|
|
56
|
+
payload: {
|
|
57
|
+
params?: object;
|
|
58
|
+
};
|
|
59
|
+
source?: string;
|
|
60
|
+
target?: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: "PRELOAD";
|
|
63
|
+
payload: {
|
|
64
|
+
name: string;
|
|
65
|
+
params?: object;
|
|
66
|
+
};
|
|
67
|
+
source?: string;
|
|
68
|
+
target?: string;
|
|
69
|
+
} | {
|
|
70
|
+
readonly type: "RESET";
|
|
71
|
+
readonly payload: (Readonly<{
|
|
72
|
+
key: string;
|
|
73
|
+
index: number;
|
|
74
|
+
routeNames: string[];
|
|
75
|
+
history?: unknown[];
|
|
76
|
+
routes: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>[];
|
|
77
|
+
type: string;
|
|
78
|
+
stale: false;
|
|
79
|
+
}> | import("@react-navigation/routers").PartialState<Readonly<{
|
|
80
|
+
key: string;
|
|
81
|
+
index: number;
|
|
82
|
+
routeNames: string[];
|
|
83
|
+
history?: unknown[];
|
|
84
|
+
routes: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>[];
|
|
85
|
+
type: string;
|
|
86
|
+
stale: false;
|
|
87
|
+
}>> | (Omit<Readonly<{
|
|
88
|
+
key: string;
|
|
89
|
+
index: number;
|
|
90
|
+
routeNames: string[];
|
|
91
|
+
history?: unknown[];
|
|
92
|
+
routes: import("@react-navigation/routers").NavigationRoute<import("@react-navigation/routers").ParamListBase, string>[];
|
|
93
|
+
type: string;
|
|
94
|
+
stale: false;
|
|
95
|
+
}>, "routes"> & {
|
|
96
|
+
routes: Omit<import("@react-navigation/routers").Route<string>, "key">[];
|
|
97
|
+
})) | undefined;
|
|
98
|
+
};
|
|
1
99
|
/**
|
|
2
100
|
* Helpers to build href or action based on the linking options.
|
|
3
101
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLinkBuilder.d.ts","sourceRoot":"","sources":["../../../src/useLinkBuilder.tsx"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAgB,cAAc;
|
|
1
|
+
{"version":3,"file":"useLinkBuilder.d.ts","sourceRoot":"","sources":["../../../src/useLinkBuilder.tsx"],"names":[],"mappings":"AAkBA;;GAEG;AACH,wBAAgB,YAAY,WAWjB,MAAM,WAAW,MAAM,wBAmEjC;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,eAQhB,MAAM;;;;;;;;;;;;;;;;;;;;;;;cA7FV,CAAC;YAAsB,CAAC;aAAuB,CAAC;WAEnD,CAAC;;;;;;;;cAIwB,CAAC;aAAuB,CAAC;;;;;;;cAS3C,CAAC;;;;;;;cAKgD,CAAC;;;;;;;;cAIrD,CAAN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwFD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc;sBA1GnB,MAAM,WAAW,MAAM;wBAgFvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;kBA7FV,CAAC;gBAAsB,CAAC;iBAAuB,CAAC;eAEnD,CAAC;;;;;;;;kBAIwB,CAAC;iBAAuB,CAAC;;;;;;;kBAS3C,CAAC;;;;;;;kBAKgD,CAAC;;;;;;;;kBAIrD,CAAN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-navigation/native",
|
|
3
3
|
"description": "React Native integration for React Navigation",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.27",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"react-navigation",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
]
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "de1f6ebc3eaebd2d9ec3b29928e8976095b31b90"
|
|
87
87
|
}
|
package/src/useLinkBuilder.tsx
CHANGED
|
@@ -17,11 +17,9 @@ type MinimalState = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
|
|
20
|
+
* Helper to build a href for a screen based on the linking options.
|
|
23
21
|
*/
|
|
24
|
-
export function
|
|
22
|
+
export function useBuildHref() {
|
|
25
23
|
const navigation = React.useContext(NavigationHelpersContext);
|
|
26
24
|
const route = React.useContext(NavigationRouteContext);
|
|
27
25
|
|
|
@@ -30,9 +28,6 @@ export function useLinkBuilder() {
|
|
|
30
28
|
const focusedRouteState = useStateForPath();
|
|
31
29
|
|
|
32
30
|
const getPathFromStateHelper = options?.getPathFromState ?? getPathFromState;
|
|
33
|
-
const getStateFromPathHelper = options?.getStateFromPath ?? getStateFromPath;
|
|
34
|
-
const getActionFromStateHelper =
|
|
35
|
-
options?.getActionFromState ?? getActionFromState;
|
|
36
31
|
|
|
37
32
|
const buildHref = React.useCallback(
|
|
38
33
|
(name: string, params?: object) => {
|
|
@@ -101,6 +96,19 @@ export function useLinkBuilder() {
|
|
|
101
96
|
]
|
|
102
97
|
);
|
|
103
98
|
|
|
99
|
+
return buildHref;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Helper to build a navigation action from a href based on the linking options.
|
|
104
|
+
*/
|
|
105
|
+
export const useBuildAction = () => {
|
|
106
|
+
const { options } = React.useContext(LinkingContext);
|
|
107
|
+
|
|
108
|
+
const getStateFromPathHelper = options?.getStateFromPath ?? getStateFromPath;
|
|
109
|
+
const getActionFromStateHelper =
|
|
110
|
+
options?.getActionFromState ?? getActionFromState;
|
|
111
|
+
|
|
104
112
|
const buildAction = React.useCallback(
|
|
105
113
|
(href: string) => {
|
|
106
114
|
if (!href.startsWith('/')) {
|
|
@@ -120,6 +128,18 @@ export function useLinkBuilder() {
|
|
|
120
128
|
[options?.config, getStateFromPathHelper, getActionFromStateHelper]
|
|
121
129
|
);
|
|
122
130
|
|
|
131
|
+
return buildAction;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Helpers to build href or action based on the linking options.
|
|
136
|
+
*
|
|
137
|
+
* @returns `buildHref` to build an `href` for screen and `buildAction` to build an action from an `href`.
|
|
138
|
+
*/
|
|
139
|
+
export function useLinkBuilder() {
|
|
140
|
+
const buildHref = useBuildHref();
|
|
141
|
+
const buildAction = useBuildAction();
|
|
142
|
+
|
|
123
143
|
return {
|
|
124
144
|
buildHref,
|
|
125
145
|
buildAction,
|
package/src/useLinkTo.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NavigationContainerRefContext } from '@react-navigation/core';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useBuildAction } from './useLinkBuilder';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Helper to navigate to a screen using a href based on the linking options.
|
|
@@ -10,7 +10,7 @@ import { useLinkBuilder } from './useLinkBuilder';
|
|
|
10
10
|
*/
|
|
11
11
|
export function useLinkTo() {
|
|
12
12
|
const navigation = React.useContext(NavigationContainerRefContext);
|
|
13
|
-
const
|
|
13
|
+
const buildAction = useBuildAction();
|
|
14
14
|
|
|
15
15
|
const linkTo = React.useCallback(
|
|
16
16
|
(href: string) => {
|