@react-navigation/native 7.0.1 → 7.0.3
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/commonjs/index.js +1 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/typescript/module/src/index.d.ts +0 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/index.tsx +0 -1
- package/lib/commonjs/useUnhandledLinking.js +0 -75
- package/lib/commonjs/useUnhandledLinking.js.map +0 -1
- package/lib/module/useUnhandledLinking.js +0 -71
- package/lib/module/useUnhandledLinking.js.map +0 -1
- package/lib/typescript/commonjs/src/useUnhandledLinking.d.ts +0 -7
- package/lib/typescript/commonjs/src/useUnhandledLinking.d.ts.map +0 -1
- package/lib/typescript/module/src/useUnhandledLinking.d.ts +0 -7
- package/lib/typescript/module/src/useUnhandledLinking.d.ts.map +0 -1
- package/src/useUnhandledLinking.tsx +0 -91
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.UNSTABLE_useUnhandledLinking = UNSTABLE_useUnhandledLinking;
|
|
7
|
-
var _core = require("@react-navigation/core");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _useLatestCallback = _interopRequireDefault(require("use-latest-callback"));
|
|
10
|
-
var _LinkingContext = require("./LinkingContext.js");
|
|
11
|
-
var _UnhandledLinkingContext = require("./UnhandledLinkingContext.js");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
// FIXME: don't rely on depth only to get the navigator state
|
|
14
|
-
function extractNavigatorSpecificState(_, pathState, depth) {
|
|
15
|
-
let partialPathState = pathState;
|
|
16
|
-
let currentDepth = depth;
|
|
17
|
-
while (currentDepth) {
|
|
18
|
-
if (!partialPathState) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
partialPathState = partialPathState.routes[partialPathState.routes.length - 1].state;
|
|
22
|
-
currentDepth--;
|
|
23
|
-
}
|
|
24
|
-
return partialPathState;
|
|
25
|
-
}
|
|
26
|
-
function UNSTABLE_useUnhandledLinking() {
|
|
27
|
-
const navigation = _react.default.useContext(_core.NavigationContext);
|
|
28
|
-
const linking = _react.default.useContext(_LinkingContext.LinkingContext);
|
|
29
|
-
const {
|
|
30
|
-
setLastUnhandledLink,
|
|
31
|
-
lastUnhandledLink
|
|
32
|
-
} = _react.default.useContext(_UnhandledLinkingContext.UnhandledLinkingContext);
|
|
33
|
-
const {
|
|
34
|
-
options
|
|
35
|
-
} = linking;
|
|
36
|
-
const getStateForRouteNamesChange = currentState => {
|
|
37
|
-
if (lastUnhandledLink == null) {
|
|
38
|
-
// noop, nothing to handle
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// at web, the path is already extracted
|
|
43
|
-
const path = lastUnhandledLink;
|
|
44
|
-
if (!lastUnhandledLink) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// First, we parse the URL to get the desired state
|
|
49
|
-
const getStateFromPathHelper = options?.getStateFromPath ?? _core.getStateFromPath;
|
|
50
|
-
const pathState = getStateFromPathHelper(path, options?.config);
|
|
51
|
-
if (!pathState) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let depth = 0;
|
|
55
|
-
let parent = navigation;
|
|
56
|
-
while (parent) {
|
|
57
|
-
depth++;
|
|
58
|
-
parent = parent.getParent();
|
|
59
|
-
}
|
|
60
|
-
const state = extractNavigatorSpecificState(currentState, pathState, depth);
|
|
61
|
-
if (!state) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
return state;
|
|
65
|
-
};
|
|
66
|
-
const clearUnhandledLink = (0, _useLatestCallback.default)(() => {
|
|
67
|
-
setLastUnhandledLink(undefined);
|
|
68
|
-
});
|
|
69
|
-
return {
|
|
70
|
-
lastUnhandledLink,
|
|
71
|
-
getStateForRouteNamesChange,
|
|
72
|
-
clearUnhandledLink
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=useUnhandledLinking.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_react","_interopRequireDefault","_useLatestCallback","_LinkingContext","_UnhandledLinkingContext","e","__esModule","default","extractNavigatorSpecificState","_","pathState","depth","partialPathState","currentDepth","undefined","routes","length","state","UNSTABLE_useUnhandledLinking","navigation","React","useContext","NavigationContext","linking","LinkingContext","setLastUnhandledLink","lastUnhandledLink","UnhandledLinkingContext","options","getStateForRouteNamesChange","currentState","path","getStateFromPathHelper","getStateFromPath","config","parent","getParent","clearUnhandledLink","useLatestCallback"],"sourceRoot":"../../src","sources":["useUnhandledLinking.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AAAoE,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpE;AACA,SAASG,6BAA6BA,CACpCC,CAAkB,EAClBC,SAAwC,EACxCC,KAAa,EACb;EACA,IAAIC,gBAA2D,GAAGF,SAAS;EAE3E,IAAIG,YAAY,GAAGF,KAAK;EACxB,OAAOE,YAAY,EAAE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;EAED,MAAMoB,kBAAkB,GAAG,IAAAC,0BAAiB,EAAC,MAAM;IACjDb,oBAAoB,CAACX,SAAS,CAAC;EACjC,CAAC,CAAC;EAEF,OAAO;IACLY,iBAAiB;IACjBG,2BAA2B;IAC3BQ;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { getStateFromPath, NavigationContext } from '@react-navigation/core';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import useLatestCallback from 'use-latest-callback';
|
|
6
|
-
import { LinkingContext } from "./LinkingContext.js";
|
|
7
|
-
import { UnhandledLinkingContext } from "./UnhandledLinkingContext.js";
|
|
8
|
-
|
|
9
|
-
// FIXME: don't rely on depth only to get the navigator state
|
|
10
|
-
function extractNavigatorSpecificState(_, pathState, depth) {
|
|
11
|
-
let partialPathState = pathState;
|
|
12
|
-
let currentDepth = depth;
|
|
13
|
-
while (currentDepth) {
|
|
14
|
-
if (!partialPathState) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
partialPathState = partialPathState.routes[partialPathState.routes.length - 1].state;
|
|
18
|
-
currentDepth--;
|
|
19
|
-
}
|
|
20
|
-
return partialPathState;
|
|
21
|
-
}
|
|
22
|
-
export function UNSTABLE_useUnhandledLinking() {
|
|
23
|
-
const navigation = React.useContext(NavigationContext);
|
|
24
|
-
const linking = React.useContext(LinkingContext);
|
|
25
|
-
const {
|
|
26
|
-
setLastUnhandledLink,
|
|
27
|
-
lastUnhandledLink
|
|
28
|
-
} = React.useContext(UnhandledLinkingContext);
|
|
29
|
-
const {
|
|
30
|
-
options
|
|
31
|
-
} = linking;
|
|
32
|
-
const getStateForRouteNamesChange = currentState => {
|
|
33
|
-
if (lastUnhandledLink == null) {
|
|
34
|
-
// noop, nothing to handle
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// at web, the path is already extracted
|
|
39
|
-
const path = lastUnhandledLink;
|
|
40
|
-
if (!lastUnhandledLink) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// First, we parse the URL to get the desired state
|
|
45
|
-
const getStateFromPathHelper = options?.getStateFromPath ?? getStateFromPath;
|
|
46
|
-
const pathState = getStateFromPathHelper(path, options?.config);
|
|
47
|
-
if (!pathState) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let depth = 0;
|
|
51
|
-
let parent = navigation;
|
|
52
|
-
while (parent) {
|
|
53
|
-
depth++;
|
|
54
|
-
parent = parent.getParent();
|
|
55
|
-
}
|
|
56
|
-
const state = extractNavigatorSpecificState(currentState, pathState, depth);
|
|
57
|
-
if (!state) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
return state;
|
|
61
|
-
};
|
|
62
|
-
const clearUnhandledLink = useLatestCallback(() => {
|
|
63
|
-
setLastUnhandledLink(undefined);
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
lastUnhandledLink,
|
|
67
|
-
getStateForRouteNamesChange,
|
|
68
|
-
clearUnhandledLink
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=useUnhandledLinking.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getStateFromPath","NavigationContext","React","useLatestCallback","LinkingContext","UnhandledLinkingContext","extractNavigatorSpecificState","_","pathState","depth","partialPathState","currentDepth","undefined","routes","length","state","UNSTABLE_useUnhandledLinking","navigation","useContext","linking","setLastUnhandledLink","lastUnhandledLink","options","getStateForRouteNamesChange","currentState","path","getStateFromPathHelper","config","parent","getParent","clearUnhandledLink"],"sourceRoot":"../../src","sources":["useUnhandledLinking.tsx"],"mappings":";;AAAA,SACEA,gBAAgB,EAChBC,iBAAiB,QAGZ,wBAAwB;AAC/B,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,iBAAiB,MAAM,qBAAqB;AAEnD,SAASC,cAAc,QAAQ,qB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KAAK,EAAE;MACPmB,MAAM,GAAGA,MAAM,CAACC,SAAS,CAAC,CAAC;IAC7B;IAEA,MAAMd,KAAK,GAAGT,6BAA6B,CAACkB,YAAY,EAAEhB,SAAS,EAAEC,KAAK,CAAC;IAE3E,IAAI,CAACM,KAAK,EAAE;MACV;IACF;IAEA,OAAOA,KAAK;EACd,CAAC;EAED,MAAMe,kBAAkB,GAAG3B,iBAAiB,CAAC,MAAM;IACjDiB,oBAAoB,CAACR,SAAS,CAAC;EACjC,CAAC,CAAC;EAEF,OAAO;IACLS,iBAAiB;IACjBE,2BAA2B;IAC3BO;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type NavigationState, type PartialState } from '@react-navigation/core';
|
|
2
|
-
export declare function UNSTABLE_useUnhandledLinking(): {
|
|
3
|
-
lastUnhandledLink: string | undefined;
|
|
4
|
-
getStateForRouteNamesChange: (currentState: NavigationState) => PartialState<NavigationState> | undefined;
|
|
5
|
-
clearUnhandledLink: () => void;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=useUnhandledLinking.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUnhandledLinking.d.ts","sourceRoot":"","sources":["../../../../src/useUnhandledLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AA2BhC,wBAAgB,4BAA4B;;gDAU1B,eAAe,KAC5B,YAAY,CAAC,eAAe,CAAC,GAAG,SAAS;;EA+C7C"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type NavigationState, type PartialState } from '@react-navigation/core';
|
|
2
|
-
export declare function UNSTABLE_useUnhandledLinking(): {
|
|
3
|
-
lastUnhandledLink: string | undefined;
|
|
4
|
-
getStateForRouteNamesChange: (currentState: NavigationState) => PartialState<NavigationState> | undefined;
|
|
5
|
-
clearUnhandledLink: () => void;
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=useUnhandledLinking.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUnhandledLinking.d.ts","sourceRoot":"","sources":["../../../../src/useUnhandledLinking.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AA2BhC,wBAAgB,4BAA4B;;gDAU1B,eAAe,KAC5B,YAAY,CAAC,eAAe,CAAC,GAAG,SAAS;;EA+C7C"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getStateFromPath,
|
|
3
|
-
NavigationContext,
|
|
4
|
-
type NavigationState,
|
|
5
|
-
type PartialState,
|
|
6
|
-
} from '@react-navigation/core';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import useLatestCallback from 'use-latest-callback';
|
|
9
|
-
|
|
10
|
-
import { LinkingContext } from './LinkingContext';
|
|
11
|
-
import { UnhandledLinkingContext } from './UnhandledLinkingContext';
|
|
12
|
-
|
|
13
|
-
// FIXME: don't rely on depth only to get the navigator state
|
|
14
|
-
function extractNavigatorSpecificState(
|
|
15
|
-
_: NavigationState,
|
|
16
|
-
pathState: PartialState<NavigationState>,
|
|
17
|
-
depth: number
|
|
18
|
-
) {
|
|
19
|
-
let partialPathState: PartialState<NavigationState> | undefined = pathState;
|
|
20
|
-
|
|
21
|
-
let currentDepth = depth;
|
|
22
|
-
while (currentDepth) {
|
|
23
|
-
if (!partialPathState) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
partialPathState =
|
|
27
|
-
partialPathState.routes[partialPathState.routes.length - 1].state;
|
|
28
|
-
currentDepth--;
|
|
29
|
-
}
|
|
30
|
-
return partialPathState;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function UNSTABLE_useUnhandledLinking() {
|
|
34
|
-
const navigation = React.useContext(NavigationContext);
|
|
35
|
-
const linking = React.useContext(LinkingContext);
|
|
36
|
-
const { setLastUnhandledLink, lastUnhandledLink } = React.useContext(
|
|
37
|
-
UnhandledLinkingContext
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const { options } = linking;
|
|
41
|
-
|
|
42
|
-
const getStateForRouteNamesChange = (
|
|
43
|
-
currentState: NavigationState
|
|
44
|
-
): PartialState<NavigationState> | undefined => {
|
|
45
|
-
if (lastUnhandledLink == null) {
|
|
46
|
-
// noop, nothing to handle
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// at web, the path is already extracted
|
|
51
|
-
const path = lastUnhandledLink;
|
|
52
|
-
if (!lastUnhandledLink) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// First, we parse the URL to get the desired state
|
|
57
|
-
const getStateFromPathHelper =
|
|
58
|
-
options?.getStateFromPath ?? getStateFromPath;
|
|
59
|
-
|
|
60
|
-
const pathState = getStateFromPathHelper(path, options?.config);
|
|
61
|
-
|
|
62
|
-
if (!pathState) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let depth = 0;
|
|
67
|
-
let parent = navigation;
|
|
68
|
-
while (parent) {
|
|
69
|
-
depth++;
|
|
70
|
-
parent = parent.getParent();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const state = extractNavigatorSpecificState(currentState, pathState, depth);
|
|
74
|
-
|
|
75
|
-
if (!state) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return state;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const clearUnhandledLink = useLatestCallback(() => {
|
|
83
|
-
setLastUnhandledLink(undefined);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
lastUnhandledLink,
|
|
88
|
-
getStateForRouteNamesChange,
|
|
89
|
-
clearUnhandledLink,
|
|
90
|
-
};
|
|
91
|
-
}
|