@react-navigation/native 6.0.16 → 6.1.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/lib/commonjs/Link.js +2 -12
- package/lib/commonjs/Link.js.map +1 -1
- package/lib/commonjs/LinkingContext.js +0 -4
- package/lib/commonjs/LinkingContext.js.map +1 -1
- package/lib/commonjs/NavigationContainer.js +9 -31
- package/lib/commonjs/NavigationContainer.js.map +1 -1
- package/lib/commonjs/ServerContainer.js +2 -12
- package/lib/commonjs/ServerContainer.js.map +1 -1
- package/lib/commonjs/ServerContext.js +0 -4
- package/lib/commonjs/ServerContext.js.map +1 -1
- package/lib/commonjs/createMemoryHistory.js +36 -53
- package/lib/commonjs/createMemoryHistory.js.map +1 -1
- package/lib/commonjs/extractPathFromURL.js +2 -8
- package/lib/commonjs/extractPathFromURL.js.map +1 -1
- package/lib/commonjs/index.js +0 -17
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theming/DarkTheme.js.map +1 -1
- package/lib/commonjs/theming/DefaultTheme.js.map +1 -1
- package/lib/commonjs/theming/ThemeContext.js +0 -6
- package/lib/commonjs/theming/ThemeContext.js.map +1 -1
- package/lib/commonjs/theming/ThemeProvider.js +0 -6
- package/lib/commonjs/theming/ThemeProvider.js.map +1 -1
- package/lib/commonjs/theming/useTheme.js +0 -6
- package/lib/commonjs/theming/useTheme.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useBackButton.js +0 -9
- package/lib/commonjs/useBackButton.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.js +1 -12
- package/lib/commonjs/useDocumentTitle.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.native.js +2 -2
- package/lib/commonjs/useDocumentTitle.native.js.map +1 -1
- package/lib/commonjs/useLinkBuilder.js +5 -15
- package/lib/commonjs/useLinkBuilder.js.map +1 -1
- package/lib/commonjs/useLinkProps.js +8 -24
- package/lib/commonjs/useLinkProps.js.map +1 -1
- package/lib/commonjs/useLinkTo.js +0 -12
- package/lib/commonjs/useLinkTo.js.map +1 -1
- package/lib/commonjs/useLinking.js +35 -79
- package/lib/commonjs/useLinking.js.map +1 -1
- package/lib/commonjs/useLinking.native.js +9 -36
- package/lib/commonjs/useLinking.native.js.map +1 -1
- package/lib/commonjs/useScrollToTop.js +48 -47
- package/lib/commonjs/useScrollToTop.js.map +1 -1
- package/lib/commonjs/useThenable.js +2 -9
- package/lib/commonjs/useThenable.js.map +1 -1
- package/lib/module/Link.js +2 -6
- package/lib/module/Link.js.map +1 -1
- package/lib/module/LinkingContext.js.map +1 -1
- package/lib/module/NavigationContainer.js +9 -18
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/ServerContainer.js +2 -5
- package/lib/module/ServerContainer.js.map +1 -1
- package/lib/module/ServerContext.js.map +1 -1
- package/lib/module/createMemoryHistory.js +36 -51
- package/lib/module/createMemoryHistory.js.map +1 -1
- package/lib/module/extractPathFromURL.js +2 -5
- package/lib/module/extractPathFromURL.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/theming/DarkTheme.js.map +1 -1
- package/lib/module/theming/DefaultTheme.js.map +1 -1
- package/lib/module/theming/ThemeContext.js.map +1 -1
- package/lib/module/theming/ThemeProvider.js.map +1 -1
- package/lib/module/theming/useTheme.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/useBackButton.js +0 -3
- package/lib/module/useBackButton.js.map +1 -1
- package/lib/module/useDocumentTitle.js +1 -9
- package/lib/module/useDocumentTitle.js.map +1 -1
- package/lib/module/useDocumentTitle.native.js +2 -1
- package/lib/module/useDocumentTitle.native.js.map +1 -1
- package/lib/module/useLinkBuilder.js +5 -9
- package/lib/module/useLinkBuilder.js.map +1 -1
- package/lib/module/useLinkProps.js +8 -16
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/module/useLinkTo.js +0 -5
- package/lib/module/useLinkTo.js.map +1 -1
- package/lib/module/useLinking.js +35 -70
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +9 -26
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/module/useScrollToTop.js +48 -43
- package/lib/module/useScrollToTop.js.map +1 -1
- package/lib/module/useThenable.js +2 -5
- package/lib/module/useThenable.js.map +1 -1
- package/lib/typescript/src/Link.d.ts +1 -0
- package/lib/typescript/src/Link.d.ts.map +1 -0
- package/lib/typescript/src/LinkingContext.d.ts +1 -0
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationContainer.d.ts +1 -0
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -0
- package/lib/typescript/src/ServerContainer.d.ts +1 -0
- package/lib/typescript/src/ServerContainer.d.ts.map +1 -0
- package/lib/typescript/src/ServerContext.d.ts +1 -0
- package/lib/typescript/src/ServerContext.d.ts.map +1 -0
- package/lib/typescript/src/__mocks__/window.d.ts +1 -0
- package/lib/typescript/src/__mocks__/window.d.ts.map +1 -0
- package/lib/typescript/src/createMemoryHistory.d.ts +1 -0
- package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -0
- package/lib/typescript/src/extractPathFromURL.d.ts +1 -0
- package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/theming/DarkTheme.d.ts +1 -0
- package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -0
- package/lib/typescript/src/theming/DefaultTheme.d.ts +1 -0
- package/lib/typescript/src/theming/DefaultTheme.d.ts.map +1 -0
- package/lib/typescript/src/theming/ThemeContext.d.ts +1 -0
- package/lib/typescript/src/theming/ThemeContext.d.ts.map +1 -0
- package/lib/typescript/src/theming/ThemeProvider.d.ts +1 -0
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/src/theming/useTheme.d.ts +1 -0
- package/lib/typescript/src/theming/useTheme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +1 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/useBackButton.d.ts +1 -0
- package/lib/typescript/src/useBackButton.d.ts.map +1 -0
- package/lib/typescript/src/useDocumentTitle.d.ts +1 -0
- package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -0
- package/lib/typescript/src/useDocumentTitle.native.d.ts +1 -0
- package/lib/typescript/src/useDocumentTitle.native.d.ts.map +1 -0
- package/lib/typescript/src/useLinkBuilder.d.ts +1 -0
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -0
- package/lib/typescript/src/useLinkProps.d.ts +1 -0
- package/lib/typescript/src/useLinkProps.d.ts.map +1 -0
- package/lib/typescript/src/useLinkTo.d.ts +1 -0
- package/lib/typescript/src/useLinkTo.d.ts.map +1 -0
- package/lib/typescript/src/useLinking.d.ts +1 -0
- package/lib/typescript/src/useLinking.d.ts.map +1 -0
- package/lib/typescript/src/useLinking.native.d.ts +1 -0
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -0
- package/lib/typescript/src/useScrollToTop.d.ts +1 -0
- package/lib/typescript/src/useScrollToTop.d.ts.map +1 -0
- package/lib/typescript/src/useThenable.d.ts +1 -0
- package/lib/typescript/src/useThenable.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/createMemoryHistory.tsx +10 -2
- package/src/useScrollToTop.tsx +52 -38
|
@@ -4,27 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = extractPathFromURL;
|
|
7
|
-
|
|
8
7
|
var _escapeStringRegexp = _interopRequireDefault(require("escape-string-regexp"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
function extractPathFromURL(prefixes, url) {
|
|
13
10
|
for (const prefix of prefixes) {
|
|
14
|
-
var _prefix$match
|
|
15
|
-
|
|
16
|
-
const protocol = (_prefix$match$ = (_prefix$match = prefix.match(/^[^:]+:/)) === null || _prefix$match === void 0 ? void 0 : _prefix$match[0]) !== null && _prefix$match$ !== void 0 ? _prefix$match$ : '';
|
|
11
|
+
var _prefix$match;
|
|
12
|
+
const protocol = ((_prefix$match = prefix.match(/^[^:]+:/)) === null || _prefix$match === void 0 ? void 0 : _prefix$match[0]) ?? '';
|
|
17
13
|
const host = prefix.replace(new RegExp(`^${(0, _escapeStringRegexp.default)(protocol)}`), '').replace(/\/+/g, '/') // Replace multiple slash (//) with single ones
|
|
18
14
|
.replace(/^\//, ''); // Remove extra leading slash
|
|
19
15
|
|
|
20
16
|
const prefixRegex = new RegExp(`^${(0, _escapeStringRegexp.default)(protocol)}(/)*${host.split('.').map(it => it === '*' ? '[^/]+' : (0, _escapeStringRegexp.default)(it)).join('\\.')}`);
|
|
21
17
|
const normalizedURL = url.replace(/\/+/g, '/');
|
|
22
|
-
|
|
23
18
|
if (prefixRegex.test(normalizedURL)) {
|
|
24
19
|
return normalizedURL.replace(prefixRegex, '');
|
|
25
20
|
}
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
return undefined;
|
|
29
23
|
}
|
|
30
24
|
//# sourceMappingURL=extractPathFromURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["extractPathFromURL","prefixes","url","prefix","protocol","match","host","replace","RegExp","escapeStringRegexp","prefixRegex","split","map","it","join","normalizedURL","test","undefined"],"
|
|
1
|
+
{"version":3,"names":["extractPathFromURL","prefixes","url","prefix","protocol","match","host","replace","RegExp","escapeStringRegexp","prefixRegex","split","map","it","join","normalizedURL","test","undefined"],"sourceRoot":"../../src","sources":["extractPathFromURL.tsx"],"mappings":";;;;;;AAAA;AAAsD;AAEvC,SAASA,kBAAkB,CAACC,QAAkB,EAAEC,GAAW,EAAE;EAC1E,KAAK,MAAMC,MAAM,IAAIF,QAAQ,EAAE;IAAA;IAC7B,MAAMG,QAAQ,GAAG,kBAAAD,MAAM,CAACE,KAAK,CAAC,SAAS,CAAC,kDAAvB,cAA0B,CAAC,CAAC,KAAI,EAAE;IACnD,MAAMC,IAAI,GAAGH,MAAM,CAChBI,OAAO,CAAC,IAAIC,MAAM,CAAE,IAAG,IAAAC,2BAAkB,EAACL,QAAQ,CAAE,EAAC,CAAC,EAAE,EAAE,CAAC,CAC3DG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAA,CACrBA,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;;IAEvB,MAAMG,WAAW,GAAG,IAAIF,MAAM,CAC3B,IAAG,IAAAC,2BAAkB,EAACL,QAAQ,CAAE,OAAME,IAAI,CACxCK,KAAK,CAAC,GAAG,CAAC,CACVC,GAAG,CAAEC,EAAE,IAAMA,EAAE,KAAK,GAAG,GAAG,OAAO,GAAG,IAAAJ,2BAAkB,EAACI,EAAE,CAAE,CAAC,CAC5DC,IAAI,CAAC,KAAK,CAAE,EAAC,CACjB;IAED,MAAMC,aAAa,GAAGb,GAAG,CAACK,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;IAE9C,IAAIG,WAAW,CAACM,IAAI,CAACD,aAAa,CAAC,EAAE;MACnC,OAAOA,aAAa,CAACR,OAAO,CAACG,WAAW,EAAE,EAAE,CAAC;IAC/C;EACF;EAEA,OAAOO,SAAS;AAClB"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -89,25 +89,15 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
89
89
|
return _useTheme.default;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
|
|
93
92
|
var _Link = _interopRequireDefault(require("./Link"));
|
|
94
|
-
|
|
95
93
|
var _LinkingContext = _interopRequireDefault(require("./LinkingContext"));
|
|
96
|
-
|
|
97
94
|
var _NavigationContainer = _interopRequireDefault(require("./NavigationContainer"));
|
|
98
|
-
|
|
99
95
|
var _ServerContainer = _interopRequireDefault(require("./ServerContainer"));
|
|
100
|
-
|
|
101
96
|
var _DarkTheme = _interopRequireDefault(require("./theming/DarkTheme"));
|
|
102
|
-
|
|
103
97
|
var _DefaultTheme = _interopRequireDefault(require("./theming/DefaultTheme"));
|
|
104
|
-
|
|
105
98
|
var _ThemeProvider = _interopRequireDefault(require("./theming/ThemeProvider"));
|
|
106
|
-
|
|
107
99
|
var _useTheme = _interopRequireDefault(require("./theming/useTheme"));
|
|
108
|
-
|
|
109
100
|
var _types = require("./types");
|
|
110
|
-
|
|
111
101
|
Object.keys(_types).forEach(function (key) {
|
|
112
102
|
if (key === "default" || key === "__esModule") return;
|
|
113
103
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -119,17 +109,11 @@ Object.keys(_types).forEach(function (key) {
|
|
|
119
109
|
}
|
|
120
110
|
});
|
|
121
111
|
});
|
|
122
|
-
|
|
123
112
|
var _useLinkBuilder = _interopRequireDefault(require("./useLinkBuilder"));
|
|
124
|
-
|
|
125
113
|
var _useLinkProps = _interopRequireDefault(require("./useLinkProps"));
|
|
126
|
-
|
|
127
114
|
var _useLinkTo = _interopRequireDefault(require("./useLinkTo"));
|
|
128
|
-
|
|
129
115
|
var _useScrollToTop = _interopRequireDefault(require("./useScrollToTop"));
|
|
130
|
-
|
|
131
116
|
var _core = require("@react-navigation/core");
|
|
132
|
-
|
|
133
117
|
Object.keys(_core).forEach(function (key) {
|
|
134
118
|
if (key === "default" || key === "__esModule") return;
|
|
135
119
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -141,6 +125,5 @@ Object.keys(_core).forEach(function (key) {
|
|
|
141
125
|
}
|
|
142
126
|
});
|
|
143
127
|
});
|
|
144
|
-
|
|
145
128
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
146
129
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DarkTheme","dark","colors","primary","background","card","text","border","notification"],"
|
|
1
|
+
{"version":3,"names":["DarkTheme","dark","colors","primary","background","card","text","border","notification"],"sourceRoot":"../../src","sources":["DarkTheme.tsx"],"mappings":";;;;;;AAEA,MAAMA,SAAgB,GAAG;EACvBC,IAAI,EAAE,IAAI;EACVC,MAAM,EAAE;IACNC,OAAO,EAAE,mBAAmB;IAC5BC,UAAU,EAAE,cAAc;IAC1BC,IAAI,EAAE,iBAAiB;IACvBC,IAAI,EAAE,oBAAoB;IAC1BC,MAAM,EAAE,iBAAiB;IACzBC,YAAY,EAAE;EAChB;AACF,CAAC;AAAC,eAEaR,SAAS;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DefaultTheme","dark","colors","primary","background","card","text","border","notification"],"
|
|
1
|
+
{"version":3,"names":["DefaultTheme","dark","colors","primary","background","card","text","border","notification"],"sourceRoot":"../../src","sources":["DefaultTheme.tsx"],"mappings":";;;;;;AAEA,MAAMA,YAAmB,GAAG;EAC1BC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE;IACNC,OAAO,EAAE,kBAAkB;IAC3BC,UAAU,EAAE,oBAAoB;IAChCC,IAAI,EAAE,oBAAoB;IAC1BC,IAAI,EAAE,iBAAiB;IACvBC,MAAM,EAAE,oBAAoB;IAC5BC,YAAY,EAAE;EAChB;AACF,CAAC;AAAC,eAEaR,YAAY;AAAA"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _DefaultTheme = _interopRequireDefault(require("./DefaultTheme"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
const ThemeContext = /*#__PURE__*/React.createContext(_DefaultTheme.default);
|
|
19
13
|
ThemeContext.displayName = 'ThemeContext';
|
|
20
14
|
var _default = ThemeContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ThemeContext","React","createContext","DefaultTheme","displayName"],"
|
|
1
|
+
{"version":3,"names":["ThemeContext","React","createContext","DefaultTheme","displayName"],"sourceRoot":"../../src","sources":["ThemeContext.tsx"],"mappings":";;;;;;AAAA;AAGA;AAA0C;AAAA;AAAA;AAE1C,MAAMA,YAAY,gBAAGC,KAAK,CAACC,aAAa,CAAQC,qBAAY,CAAC;AAE7DH,YAAY,CAACI,WAAW,GAAG,cAAc;AAAC,eAE3BJ,YAAY;AAAA"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = ThemeProvider;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _ThemeContext = _interopRequireDefault(require("./ThemeContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
function ThemeProvider(_ref) {
|
|
19
13
|
let {
|
|
20
14
|
value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ThemeProvider","value","children"],"
|
|
1
|
+
{"version":3,"names":["ThemeProvider","value","children"],"sourceRoot":"../../src","sources":["ThemeProvider.tsx"],"mappings":";;;;;;AAAA;AAGA;AAA0C;AAAA;AAAA;AAO3B,SAASA,aAAa,OAA6B;EAAA,IAA5B;IAAEC,KAAK;IAAEC;EAAgB,CAAC;EAC9D,oBACE,oBAAC,qBAAY,CAAC,QAAQ;IAAC,KAAK,EAAED;EAAM,GAAEC,QAAQ,CAAyB;AAE3E"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useTheme;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _ThemeContext = _interopRequireDefault(require("./ThemeContext"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
function useTheme() {
|
|
19
13
|
const theme = React.useContext(_ThemeContext.default);
|
|
20
14
|
return theme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useTheme","theme","React","useContext","ThemeContext"],"
|
|
1
|
+
{"version":3,"names":["useTheme","theme","React","useContext","ThemeContext"],"sourceRoot":"../../src","sources":["useTheme.tsx"],"mappings":";;;;;;AAAA;AAEA;AAA0C;AAAA;AAAA;AAE3B,SAASA,QAAQ,GAAG;EACjC,MAAMC,KAAK,GAAGC,KAAK,CAACC,UAAU,CAACC,qBAAY,CAAC;EAE5C,OAAOH,KAAK;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":""}
|
|
@@ -4,32 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useBackButton;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
11
|
function useBackButton(ref) {
|
|
17
12
|
React.useEffect(() => {
|
|
18
13
|
const subscription = _reactNative.BackHandler.addEventListener('hardwareBackPress', () => {
|
|
19
14
|
const navigation = ref.current;
|
|
20
|
-
|
|
21
15
|
if (navigation == null) {
|
|
22
16
|
return false;
|
|
23
17
|
}
|
|
24
|
-
|
|
25
18
|
if (navigation.canGoBack()) {
|
|
26
19
|
navigation.goBack();
|
|
27
20
|
return true;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
return false;
|
|
31
23
|
});
|
|
32
|
-
|
|
33
24
|
return () => subscription.remove();
|
|
34
25
|
}, [ref]);
|
|
35
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useBackButton","ref","React","useEffect","subscription","BackHandler","addEventListener","navigation","current","canGoBack","goBack","remove"],"
|
|
1
|
+
{"version":3,"names":["useBackButton","ref","React","useEffect","subscription","BackHandler","addEventListener","navigation","current","canGoBack","goBack","remove"],"sourceRoot":"../../src","sources":["useBackButton.tsx"],"mappings":";;;;;;AAIA;AACA;AAA2C;AAAA;AAE5B,SAASA,aAAa,CACnCC,GAA2D,EAC3D;EACAC,KAAK,CAACC,SAAS,CAAC,MAAM;IACpB,MAAMC,YAAY,GAAGC,wBAAW,CAACC,gBAAgB,CAC/C,mBAAmB,EACnB,MAAM;MACJ,MAAMC,UAAU,GAAGN,GAAG,CAACO,OAAO;MAE9B,IAAID,UAAU,IAAI,IAAI,EAAE;QACtB,OAAO,KAAK;MACd;MAEA,IAAIA,UAAU,CAACE,SAAS,EAAE,EAAE;QAC1BF,UAAU,CAACG,MAAM,EAAE;QAEnB,OAAO,IAAI;MACb;MAEA,OAAO,KAAK;IACd,CAAC,CACF;IAED,OAAO,MAAMN,YAAY,CAACO,MAAM,EAAE;EACpC,CAAC,EAAE,CAACV,GAAG,CAAC,CAAC;AACX"}
|
|
@@ -4,37 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useDocumentTitle;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
|
|
12
9
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* Set the document title for the active screen
|
|
16
12
|
*/
|
|
17
13
|
function useDocumentTitle(ref) {
|
|
18
14
|
let {
|
|
19
15
|
enabled = true,
|
|
20
|
-
formatter = (options, route) =>
|
|
21
|
-
var _options$title;
|
|
22
|
-
|
|
23
|
-
return (_options$title = options === null || options === void 0 ? void 0 : options.title) !== null && _options$title !== void 0 ? _options$title : route === null || route === void 0 ? void 0 : route.name;
|
|
24
|
-
}
|
|
16
|
+
formatter = (options, route) => (options === null || options === void 0 ? void 0 : options.title) ?? (route === null || route === void 0 ? void 0 : route.name)
|
|
25
17
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
26
18
|
React.useEffect(() => {
|
|
27
19
|
if (!enabled) {
|
|
28
20
|
return;
|
|
29
21
|
}
|
|
30
|
-
|
|
31
22
|
const navigation = ref.current;
|
|
32
|
-
|
|
33
23
|
if (navigation) {
|
|
34
24
|
const title = formatter(navigation.getCurrentOptions(), navigation.getCurrentRoute());
|
|
35
25
|
document.title = title;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
27
|
return navigation === null || navigation === void 0 ? void 0 : navigation.addListener('options', e => {
|
|
39
28
|
const title = formatter(e.data.options, navigation === null || navigation === void 0 ? void 0 : navigation.getCurrentRoute());
|
|
40
29
|
document.title = title;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDocumentTitle","ref","enabled","formatter","options","route","title","name","React","useEffect","navigation","current","getCurrentOptions","getCurrentRoute","document","addListener","e","data"],"
|
|
1
|
+
{"version":3,"names":["useDocumentTitle","ref","enabled","formatter","options","route","title","name","React","useEffect","navigation","current","getCurrentOptions","getCurrentRoute","document","addListener","e","data"],"sourceRoot":"../../src","sources":["useDocumentTitle.tsx"],"mappings":";;;;;;AAIA;AAA+B;AAAA;AAI/B;AACA;AACA;AACe,SAASA,gBAAgB,CACtCC,GAA2D,EAK3D;EAAA,IAJA;IACEC,OAAO,GAAG,IAAI;IACdC,SAAS,GAAG,CAACC,OAAO,EAAEC,KAAK,KAAK,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,KAAK,MAAID,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEE,IAAI;EACzC,CAAC,uEAAG,CAAC,CAAC;EAE5BC,KAAK,CAACC,SAAS,CAAC,MAAM;IACpB,IAAI,CAACP,OAAO,EAAE;MACZ;IACF;IAEA,MAAMQ,UAAU,GAAGT,GAAG,CAACU,OAAO;IAE9B,IAAID,UAAU,EAAE;MACd,MAAMJ,KAAK,GAAGH,SAAS,CACrBO,UAAU,CAACE,iBAAiB,EAAE,EAC9BF,UAAU,CAACG,eAAe,EAAE,CAC7B;MAEDC,QAAQ,CAACR,KAAK,GAAGA,KAAK;IACxB;IAEA,OAAOI,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEK,WAAW,CAAC,SAAS,EAAGC,CAAC,IAAK;MAC/C,MAAMV,KAAK,GAAGH,SAAS,CAACa,CAAC,CAACC,IAAI,CAACb,OAAO,EAAEM,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEG,eAAe,EAAE,CAAC;MAEtEC,QAAQ,CAACR,KAAK,GAAGA,KAAK;IACxB,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useDocumentTitle;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
function useDocumentTitle() {
|
|
8
|
+
// Noop for React Native
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=useDocumentTitle.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDocumentTitle"],"
|
|
1
|
+
{"version":3,"names":["useDocumentTitle"],"sourceRoot":"../../src","sources":["useDocumentTitle.native.tsx"],"mappings":";;;;;;AAAe,SAASA,gBAAgB,GAAG;EACzC;AAAA"}
|
|
@@ -4,40 +4,31 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useLinkBuilder;
|
|
7
|
-
|
|
8
7
|
var _core = require("@react-navigation/core");
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _LinkingContext = _interopRequireDefault(require("./LinkingContext"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
const getRootStateForNavigate = (navigation, state) => {
|
|
21
14
|
const parent = navigation.getParent();
|
|
22
|
-
|
|
23
15
|
if (parent) {
|
|
24
16
|
const parentState = parent.getState();
|
|
25
17
|
return getRootStateForNavigate(parent, {
|
|
26
18
|
index: 0,
|
|
27
|
-
routes: [{
|
|
19
|
+
routes: [{
|
|
20
|
+
...parentState.routes[parentState.index],
|
|
28
21
|
state: state
|
|
29
22
|
}]
|
|
30
23
|
});
|
|
31
24
|
}
|
|
32
|
-
|
|
33
25
|
return state;
|
|
34
26
|
};
|
|
27
|
+
|
|
35
28
|
/**
|
|
36
29
|
* Build destination link for a navigate action.
|
|
37
30
|
* Useful for showing anchor tags on the web for buttons that perform navigation.
|
|
38
31
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
32
|
function useLinkBuilder() {
|
|
42
33
|
const navigation = React.useContext(_core.NavigationHelpersContext);
|
|
43
34
|
const linking = React.useContext(_LinkingContext.default);
|
|
@@ -45,18 +36,17 @@ function useLinkBuilder() {
|
|
|
45
36
|
const {
|
|
46
37
|
options
|
|
47
38
|
} = linking;
|
|
48
|
-
|
|
49
39
|
if ((options === null || options === void 0 ? void 0 : options.enabled) === false) {
|
|
50
40
|
return undefined;
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
const state = navigation ? getRootStateForNavigate(navigation, {
|
|
54
43
|
index: 0,
|
|
55
44
|
routes: [{
|
|
56
45
|
name,
|
|
57
46
|
params
|
|
58
47
|
}]
|
|
59
|
-
}) :
|
|
48
|
+
}) :
|
|
49
|
+
// If we couldn't find a navigation object in context, we're at root
|
|
60
50
|
// So we'll construct a basic state object to use
|
|
61
51
|
{
|
|
62
52
|
index: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getRootStateForNavigate","navigation","state","parent","getParent","parentState","getState","index","routes","useLinkBuilder","React","useContext","NavigationHelpersContext","linking","LinkingContext","buildLink","useCallback","name","params","options","enabled","undefined","path","getPathFromState","config"],"
|
|
1
|
+
{"version":3,"names":["getRootStateForNavigate","navigation","state","parent","getParent","parentState","getState","index","routes","useLinkBuilder","React","useContext","NavigationHelpersContext","linking","LinkingContext","buildLink","useCallback","name","params","options","enabled","undefined","path","getPathFromState","config"],"sourceRoot":"../../src","sources":["useLinkBuilder.tsx"],"mappings":";;;;;;AAAA;AAOA;AAEA;AAA8C;AAAA;AAAA;AAW9C,MAAMA,uBAAuB,GAAG,CAC9BC,UAA4B,EAC5BC,KAAmB,KACF;EACjB,MAAMC,MAAM,GAAGF,UAAU,CAACG,SAAS,EAAE;EAErC,IAAID,MAAM,EAAE;IACV,MAAME,WAAW,GAAGF,MAAM,CAACG,QAAQ,EAAE;IAErC,OAAON,uBAAuB,CAACG,MAAM,EAAE;MACrCI,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CACN;QACE,GAAGH,WAA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"__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useLinkProps;
|
|
7
|
-
|
|
8
7
|
var _core = require("@react-navigation/core");
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _reactNative = require("react-native");
|
|
13
|
-
|
|
14
10
|
var _LinkingContext = _interopRequireDefault(require("./LinkingContext"));
|
|
15
|
-
|
|
16
11
|
var _useLinkTo = _interopRequireDefault(require("./useLinkTo"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
15
|
const getStateFromParams = params => {
|
|
25
16
|
if (params !== null && params !== void 0 && params.state) {
|
|
26
17
|
return params.state;
|
|
27
18
|
}
|
|
28
|
-
|
|
29
19
|
if (params !== null && params !== void 0 && params.screen) {
|
|
30
20
|
return {
|
|
31
21
|
routes: [{
|
|
@@ -36,20 +26,16 @@ const getStateFromParams = params => {
|
|
|
36
26
|
}]
|
|
37
27
|
};
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
return undefined;
|
|
41
30
|
};
|
|
31
|
+
|
|
42
32
|
/**
|
|
43
33
|
* Hook to get props for an anchor tag so it can work with in page navigation.
|
|
44
34
|
*
|
|
45
35
|
* @param props.to Absolute path to screen (e.g. `/feeds/hot`).
|
|
46
36
|
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
|
47
37
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
38
|
function useLinkProps(_ref) {
|
|
51
|
-
var _options$getPathFromS;
|
|
52
|
-
|
|
53
39
|
let {
|
|
54
40
|
to,
|
|
55
41
|
action
|
|
@@ -60,26 +46,25 @@ function useLinkProps(_ref) {
|
|
|
60
46
|
options
|
|
61
47
|
} = React.useContext(_LinkingContext.default);
|
|
62
48
|
const linkTo = (0, _useLinkTo.default)();
|
|
63
|
-
|
|
64
49
|
const onPress = e => {
|
|
65
50
|
var _e$currentTarget;
|
|
66
|
-
|
|
67
51
|
let shouldHandle = false;
|
|
68
|
-
|
|
69
52
|
if (_reactNative.Platform.OS !== 'web' || !e) {
|
|
70
53
|
shouldHandle = e ? !e.defaultPrevented : true;
|
|
71
|
-
} else if (!e.defaultPrevented &&
|
|
54
|
+
} else if (!e.defaultPrevented &&
|
|
55
|
+
// onPress prevented default
|
|
72
56
|
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
73
|
-
!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
|
57
|
+
!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && (
|
|
58
|
+
// ignore clicks with modifier keys
|
|
74
59
|
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
75
|
-
e.button == null || e.button === 0) &&
|
|
60
|
+
e.button == null || e.button === 0) &&
|
|
61
|
+
// ignore everything but left clicks
|
|
76
62
|
// @ts-expect-error: these properties exist on web, but not in React Native
|
|
77
63
|
[undefined, null, '', 'self'].includes((_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 ? void 0 : _e$currentTarget.target) // let browser handle "target=_blank" etc.
|
|
78
64
|
) {
|
|
79
65
|
e.preventDefault();
|
|
80
66
|
shouldHandle = true;
|
|
81
67
|
}
|
|
82
|
-
|
|
83
68
|
if (shouldHandle) {
|
|
84
69
|
if (action) {
|
|
85
70
|
if (navigation) {
|
|
@@ -94,8 +79,7 @@ function useLinkProps(_ref) {
|
|
|
94
79
|
}
|
|
95
80
|
}
|
|
96
81
|
};
|
|
97
|
-
|
|
98
|
-
const getPathFromStateHelper = (_options$getPathFromS = options === null || options === void 0 ? void 0 : options.getPathFromState) !== null && _options$getPathFromS !== void 0 ? _options$getPathFromS : _core.getPathFromState;
|
|
82
|
+
const getPathFromStateHelper = (options === null || options === void 0 ? void 0 : options.getPathFromState) ?? _core.getPathFromState;
|
|
99
83
|
const href = typeof to === 'string' ? to : getPathFromStateHelper({
|
|
100
84
|
routes: [{
|
|
101
85
|
name: to.screen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getStateFromParams","params","state","screen","routes","name","undefined","useLinkProps","to","action","root","React","useContext","NavigationContainerRefContext","navigation","NavigationHelpersContext","options","LinkingContext","linkTo","useLinkTo","onPress","e","shouldHandle","Platform","OS","defaultPrevented","metaKey","altKey","ctrlKey","shiftKey","button","includes","currentTarget","target","preventDefault","dispatch","Error","getPathFromStateHelper","getPathFromState","href","config","accessibilityRole"],"
|
|
1
|
+
{"version":3,"names":["getStateFromParams","params","state","screen","routes","name","undefined","useLinkProps","to","action","root","React","useContext","NavigationContainerRefContext","navigation","NavigationHelpersContext","options","LinkingContext","linkTo","useLinkTo","onPress","e","shouldHandle","Platform","OS","defaultPrevented","metaKey","altKey","ctrlKey","shiftKey","button","includes","currentTarget","target","preventDefault","dispatch","Error","getPathFromStateHelper","getPathFromState","href","config","accessibilityRole"],"sourceRoot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AAC;AACH"}
|
|
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useLinkTo;
|
|
7
|
-
|
|
8
7
|
var _core = require("@react-navigation/core");
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _LinkingContext = _interopRequireDefault(require("./LinkingContext"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
function useLinkTo() {
|
|
21
14
|
const navigation = React.useContext(_core.NavigationContainerRefContext);
|
|
22
15
|
const linking = React.useContext(_LinkingContext.default);
|
|
@@ -24,25 +17,20 @@ function useLinkTo() {
|
|
|
24
17
|
if (navigation === undefined) {
|
|
25
18
|
throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");
|
|
26
19
|
}
|
|
27
|
-
|
|
28
20
|
if (typeof to !== 'string') {
|
|
29
21
|
// @ts-expect-error: This is fine
|
|
30
22
|
navigation.navigate(to.screen, to.params);
|
|
31
23
|
return;
|
|
32
24
|
}
|
|
33
|
-
|
|
34
25
|
if (!to.startsWith('/')) {
|
|
35
26
|
throw new Error(`The path must start with '/' (${to}).`);
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
const {
|
|
39
29
|
options
|
|
40
30
|
} = linking;
|
|
41
31
|
const state = options !== null && options !== void 0 && options.getStateFromPath ? options.getStateFromPath(to, options.config) : (0, _core.getStateFromPath)(to, options === null || options === void 0 ? void 0 : options.config);
|
|
42
|
-
|
|
43
32
|
if (state) {
|
|
44
33
|
const action = (0, _core.getActionFromState)(state, options === null || options === void 0 ? void 0 : options.config);
|
|
45
|
-
|
|
46
34
|
if (action !== undefined) {
|
|
47
35
|
navigation.dispatch(action);
|
|
48
36
|
} else {
|