@react-navigation/native 7.0.0-alpha.0 → 7.0.0-alpha.10
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 +16 -9
- package/lib/commonjs/Link.js.map +1 -1
- package/lib/commonjs/LinkingContext.js +8 -7
- package/lib/commonjs/LinkingContext.js.map +1 -1
- package/lib/commonjs/LocaleDirContext.js +12 -0
- package/lib/commonjs/LocaleDirContext.js.map +1 -0
- package/lib/commonjs/NavigationContainer.js +68 -32
- package/lib/commonjs/NavigationContainer.js.map +1 -1
- package/lib/commonjs/ServerContainer.js +6 -8
- package/lib/commonjs/ServerContainer.js.map +1 -1
- package/lib/commonjs/ServerContext.js +4 -6
- package/lib/commonjs/ServerContext.js.map +1 -1
- package/lib/commonjs/UnhandledLinkingContext.js +20 -0
- package/lib/commonjs/UnhandledLinkingContext.js.map +1 -0
- package/lib/commonjs/__stubs__/createStackNavigator.js +19 -0
- package/lib/commonjs/__stubs__/createStackNavigator.js.map +1 -0
- package/lib/commonjs/__stubs__/window.js +79 -0
- package/lib/commonjs/__stubs__/window.js.map +1 -0
- package/lib/commonjs/createMemoryHistory.js +5 -8
- package/lib/commonjs/createMemoryHistory.js.map +1 -1
- package/lib/commonjs/createStaticNavigation.js +8 -8
- package/lib/commonjs/createStaticNavigation.js.map +1 -1
- package/lib/commonjs/extractPathFromURL.js +4 -4
- package/lib/commonjs/extractPathFromURL.js.map +1 -1
- package/lib/commonjs/index.js +33 -34
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theming/DarkTheme.js +5 -5
- package/lib/commonjs/theming/DarkTheme.js.map +1 -1
- package/lib/commonjs/theming/DefaultTheme.js +5 -5
- package/lib/commonjs/theming/DefaultTheme.js.map +1 -1
- package/lib/commonjs/theming/fonts.js +65 -0
- package/lib/commonjs/theming/fonts.js.map +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/useBackButton.js +4 -20
- package/lib/commonjs/useBackButton.js.map +1 -1
- package/lib/commonjs/useBackButton.native.js +27 -0
- package/lib/commonjs/useBackButton.native.js.map +1 -0
- package/lib/commonjs/useDocumentTitle.js +6 -6
- package/lib/commonjs/useDocumentTitle.js.map +1 -1
- package/lib/commonjs/useDocumentTitle.native.js +1 -1
- package/lib/commonjs/useDocumentTitle.native.js.map +1 -1
- package/lib/commonjs/useLinkBuilder.js +80 -0
- package/lib/commonjs/useLinkBuilder.js.map +1 -0
- package/lib/commonjs/useLinkProps.js +23 -27
- package/lib/commonjs/useLinkProps.js.map +1 -1
- package/lib/commonjs/useLinkTo.js +30 -0
- package/lib/commonjs/useLinkTo.js.map +1 -0
- package/lib/commonjs/useLinking.js +39 -40
- package/lib/commonjs/useLinking.js.map +1 -1
- package/lib/commonjs/useLinking.native.js +33 -27
- package/lib/commonjs/useLinking.native.js.map +1 -1
- package/lib/commonjs/useLocale.js +23 -0
- package/lib/commonjs/useLocale.js.map +1 -0
- package/lib/commonjs/useScrollToTop.js +9 -7
- package/lib/commonjs/useScrollToTop.js.map +1 -1
- package/lib/commonjs/useThenable.js +4 -3
- package/lib/commonjs/useThenable.js.map +1 -1
- package/lib/commonjs/useUnhandledLinking.js +75 -0
- package/lib/commonjs/useUnhandledLinking.js.map +1 -0
- package/lib/module/Link.js +13 -5
- package/lib/module/Link.js.map +1 -1
- package/lib/module/LinkingContext.js +5 -3
- package/lib/module/LinkingContext.js.map +1 -1
- package/lib/module/LocaleDirContext.js +4 -0
- package/lib/module/LocaleDirContext.js.map +1 -0
- package/lib/module/NavigationContainer.js +60 -23
- package/lib/module/NavigationContainer.js.map +1 -1
- package/lib/module/ServerContainer.js +2 -2
- package/lib/module/ServerContainer.js.map +1 -1
- package/lib/module/ServerContext.js +1 -2
- package/lib/module/ServerContext.js.map +1 -1
- package/lib/module/UnhandledLinkingContext.js +12 -0
- package/lib/module/UnhandledLinkingContext.js.map +1 -0
- package/lib/module/__stubs__/createStackNavigator.js +11 -0
- package/lib/module/__stubs__/createStackNavigator.js.map +1 -0
- package/lib/module/__stubs__/window.js +73 -0
- package/lib/module/__stubs__/window.js.map +1 -0
- package/lib/module/createMemoryHistory.js +5 -8
- package/lib/module/createMemoryHistory.js.map +1 -1
- package/lib/module/createStaticNavigation.js +5 -4
- package/lib/module/createStaticNavigation.js.map +1 -1
- package/lib/module/extractPathFromURL.js +4 -4
- package/lib/module/extractPathFromURL.js.map +1 -1
- package/lib/module/index.js +12 -12
- package/lib/module/index.js.map +1 -1
- package/lib/module/theming/DarkTheme.js +4 -3
- package/lib/module/theming/DarkTheme.js.map +1 -1
- package/lib/module/theming/DefaultTheme.js +4 -3
- package/lib/module/theming/DefaultTheme.js.map +1 -1
- package/lib/module/theming/fonts.js +59 -0
- package/lib/module/theming/fonts.js.map +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/useBackButton.js +3 -17
- package/lib/module/useBackButton.js.map +1 -1
- package/lib/module/useBackButton.native.js +19 -0
- package/lib/module/useBackButton.native.js.map +1 -0
- package/lib/module/useDocumentTitle.js +4 -4
- package/lib/module/useDocumentTitle.js.map +1 -1
- package/lib/module/useDocumentTitle.native.js +1 -1
- package/lib/module/useDocumentTitle.native.js.map +1 -1
- package/lib/module/{useLinkTools.js → useLinkBuilder.js} +11 -11
- package/lib/module/useLinkBuilder.js.map +1 -0
- package/lib/module/useLinkProps.js +20 -23
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/module/useLinkTo.js +23 -0
- package/lib/module/useLinkTo.js.map +1 -0
- package/lib/module/useLinking.js +33 -36
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +29 -22
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/module/useLocale.js +16 -0
- package/lib/module/useLocale.js.map +1 -0
- package/lib/module/useScrollToTop.js +8 -6
- package/lib/module/useScrollToTop.js.map +1 -1
- package/lib/module/useThenable.js +2 -1
- package/lib/module/useThenable.js.map +1 -1
- package/lib/module/useUnhandledLinking.js +69 -0
- package/lib/module/useUnhandledLinking.js.map +1 -0
- package/lib/typescript/src/Link.d.ts +3 -3
- package/lib/typescript/src/Link.d.ts.map +1 -1
- package/lib/typescript/src/LinkingContext.d.ts +2 -3
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
- package/lib/typescript/src/LocaleDirContext.d.ts +4 -0
- package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -0
- package/lib/typescript/src/NavigationContainer.d.ts +6 -6
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/ServerContainer.d.ts +2 -3
- package/lib/typescript/src/ServerContainer.d.ts.map +1 -1
- package/lib/typescript/src/ServerContext.d.ts +1 -2
- package/lib/typescript/src/ServerContext.d.ts.map +1 -1
- package/lib/typescript/src/UnhandledLinkingContext.d.ts +6 -0
- package/lib/typescript/src/UnhandledLinkingContext.d.ts.map +1 -0
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +32 -0
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -0
- package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts +2 -3
- package/lib/typescript/src/__stubs__/window.d.ts.map +1 -0
- package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
- package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -1
- package/lib/typescript/src/createStaticNavigation.d.ts +3 -3
- package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +12 -12
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theming/DarkTheme.d.ts +1 -2
- package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
- package/lib/typescript/src/theming/DefaultTheme.d.ts +1 -2
- package/lib/typescript/src/theming/DefaultTheme.d.ts.map +1 -1
- package/lib/typescript/src/theming/fonts.d.ts +53 -0
- package/lib/typescript/src/theming/fonts.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +41 -11
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.d.ts +2 -2
- package/lib/typescript/src/useBackButton.d.ts.map +1 -1
- package/lib/typescript/src/useBackButton.native.d.ts +4 -0
- package/lib/typescript/src/useBackButton.native.d.ts.map +1 -0
- package/lib/typescript/src/useDocumentTitle.d.ts +1 -1
- package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
- package/lib/typescript/src/useDocumentTitle.native.d.ts +1 -1
- package/lib/typescript/src/useDocumentTitle.native.d.ts.map +1 -1
- package/lib/typescript/src/useLinkBuilder.d.ts +25 -0
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -0
- package/lib/typescript/src/useLinkProps.d.ts +3 -3
- package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
- package/lib/typescript/src/useLinkTo.d.ts +6 -0
- package/lib/typescript/src/useLinkTo.d.ts.map +1 -0
- package/lib/typescript/src/useLinking.d.ts +8 -20
- package/lib/typescript/src/useLinking.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts +4 -20
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/lib/typescript/src/useLocale.d.ts +7 -0
- package/lib/typescript/src/useLocale.d.ts.map +1 -0
- package/lib/typescript/src/useScrollToTop.d.ts +1 -1
- package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
- package/lib/typescript/src/useThenable.d.ts +1 -1
- package/lib/typescript/src/useThenable.d.ts.map +1 -1
- package/lib/typescript/src/useUnhandledLinking.d.ts +7 -0
- package/lib/typescript/src/useUnhandledLinking.d.ts.map +1 -0
- package/package.json +15 -15
- package/src/Link.tsx +12 -3
- package/src/LinkingContext.tsx +9 -5
- package/src/LocaleDirContext.tsx +7 -0
- package/src/NavigationContainer.tsx +90 -36
- package/src/ServerContainer.tsx +2 -2
- package/src/ServerContext.tsx +1 -3
- package/src/UnhandledLinkingContext.tsx +18 -0
- package/src/{__mocks__ → __stubs__}/createStackNavigator.tsx +1 -3
- package/src/{__mocks__ → __stubs__}/window.tsx +8 -8
- package/src/createMemoryHistory.tsx +1 -1
- package/src/createStaticNavigation.tsx +8 -8
- package/src/extractPathFromURL.tsx +5 -2
- package/src/index.tsx +12 -12
- package/src/theming/DarkTheme.tsx +3 -3
- package/src/theming/DefaultTheme.tsx +3 -3
- package/src/theming/fonts.tsx +63 -0
- package/src/types.tsx +55 -11
- package/src/useBackButton.native.tsx +33 -0
- package/src/useBackButton.tsx +4 -26
- package/src/useDocumentTitle.native.tsx +1 -1
- package/src/useDocumentTitle.tsx +1 -1
- package/src/{useLinkTools.tsx → useLinkBuilder.tsx} +9 -9
- package/src/useLinkProps.tsx +27 -23
- package/src/useLinkTo.tsx +30 -0
- package/src/useLinking.native.tsx +28 -22
- package/src/useLinking.tsx +46 -44
- package/src/useLocale.tsx +18 -0
- package/src/useScrollToTop.tsx +14 -10
- package/src/useThenable.tsx +2 -1
- package/src/useUnhandledLinking.tsx +91 -0
- package/lib/commonjs/theming/ThemeContext.js +0 -16
- package/lib/commonjs/theming/ThemeContext.js.map +0 -1
- package/lib/commonjs/theming/ThemeProvider.js +0 -21
- package/lib/commonjs/theming/ThemeProvider.js.map +0 -1
- package/lib/commonjs/theming/useTheme.js +0 -16
- package/lib/commonjs/theming/useTheme.js.map +0 -1
- package/lib/commonjs/useLinkTools.js +0 -81
- package/lib/commonjs/useLinkTools.js.map +0 -1
- package/lib/module/theming/ThemeContext.js +0 -6
- package/lib/module/theming/ThemeContext.js.map +0 -1
- package/lib/module/theming/ThemeProvider.js +0 -12
- package/lib/module/theming/ThemeProvider.js.map +0 -1
- package/lib/module/theming/useTheme.js +0 -7
- package/lib/module/theming/useTheme.js.map +0 -1
- package/lib/module/useLinkTools.js.map +0 -1
- package/lib/typescript/src/__mocks__/createStackNavigator.d.ts +0 -57
- package/lib/typescript/src/__mocks__/createStackNavigator.d.ts.map +0 -1
- package/lib/typescript/src/__mocks__/window.d.ts.map +0 -1
- package/lib/typescript/src/theming/ThemeContext.d.ts +0 -5
- package/lib/typescript/src/theming/ThemeContext.d.ts.map +0 -1
- package/lib/typescript/src/theming/ThemeProvider.d.ts +0 -9
- package/lib/typescript/src/theming/ThemeProvider.d.ts.map +0 -1
- package/lib/typescript/src/theming/useTheme.d.ts +0 -2
- package/lib/typescript/src/theming/useTheme.d.ts.map +0 -1
- package/lib/typescript/src/useLinkTools.d.ts +0 -33
- package/lib/typescript/src/useLinkTools.d.ts.map +0 -1
- package/src/theming/ThemeContext.tsx +0 -10
- package/src/theming/ThemeProvider.tsx +0 -15
- package/src/theming/useTheme.tsx +0 -9
package/src/useLinking.tsx
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
getActionFromState as getActionFromStateDefault,
|
|
4
4
|
getPathFromState as getPathFromStateDefault,
|
|
5
5
|
getStateFromPath as getStateFromPathDefault,
|
|
6
|
-
NavigationContainerRef,
|
|
7
|
-
NavigationState,
|
|
8
|
-
ParamListBase,
|
|
6
|
+
type NavigationContainerRef,
|
|
7
|
+
type NavigationState,
|
|
8
|
+
type ParamListBase,
|
|
9
9
|
useNavigationIndependentTree,
|
|
10
10
|
} from '@react-navigation/core';
|
|
11
11
|
import isEqual from 'fast-deep-equal';
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
|
|
14
|
-
import createMemoryHistory from './createMemoryHistory';
|
|
15
|
-
import ServerContext from './ServerContext';
|
|
14
|
+
import { createMemoryHistory } from './createMemoryHistory';
|
|
15
|
+
import { ServerContext } from './ServerContext';
|
|
16
16
|
import type { LinkingOptions } from './types';
|
|
17
17
|
|
|
18
18
|
type ResultState = ReturnType<typeof getStateFromPathDefault>;
|
|
@@ -60,43 +60,20 @@ const findMatchingState = <T extends NavigationState>(
|
|
|
60
60
|
/**
|
|
61
61
|
* Run async function in series as it's called.
|
|
62
62
|
*/
|
|
63
|
-
const series = (cb: () => Promise<void>) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const callback = async () => {
|
|
69
|
-
try {
|
|
70
|
-
if (handling) {
|
|
71
|
-
// If we're currently handling a previous event, wait before handling this one
|
|
72
|
-
// Add the callback to the beginning of the queue
|
|
73
|
-
queue.unshift(callback);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
handling = true;
|
|
78
|
-
|
|
79
|
-
await cb();
|
|
80
|
-
} finally {
|
|
81
|
-
handling = false;
|
|
82
|
-
|
|
83
|
-
if (queue.length) {
|
|
84
|
-
// If we have queued items, handle the last one
|
|
85
|
-
const last = queue.pop();
|
|
86
|
-
|
|
87
|
-
last?.();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
63
|
+
export const series = (cb: () => Promise<void>) => {
|
|
64
|
+
let queue = Promise.resolve();
|
|
65
|
+
const callback = () => {
|
|
66
|
+
// eslint-disable-next-line promise/no-callback-in-promise
|
|
67
|
+
queue = queue.then(cb);
|
|
90
68
|
};
|
|
91
|
-
|
|
92
69
|
return callback;
|
|
93
70
|
};
|
|
94
71
|
|
|
95
|
-
|
|
72
|
+
const linkingHandlers: symbol[] = [];
|
|
96
73
|
|
|
97
74
|
type Options = LinkingOptions<ParamListBase>;
|
|
98
75
|
|
|
99
|
-
export
|
|
76
|
+
export function useLinking(
|
|
100
77
|
ref: React.RefObject<NavigationContainerRef<ParamListBase>>,
|
|
101
78
|
{
|
|
102
79
|
enabled = true,
|
|
@@ -104,7 +81,8 @@ export default function useLinking(
|
|
|
104
81
|
getStateFromPath = getStateFromPathDefault,
|
|
105
82
|
getPathFromState = getPathFromStateDefault,
|
|
106
83
|
getActionFromState = getActionFromStateDefault,
|
|
107
|
-
}: Options
|
|
84
|
+
}: Options,
|
|
85
|
+
onUnhandledLinking: (lastUnhandledLining: string | undefined) => void
|
|
108
86
|
) {
|
|
109
87
|
const independent = useNavigationIndependentTree();
|
|
110
88
|
|
|
@@ -163,6 +141,17 @@ export default function useLinking(
|
|
|
163
141
|
getActionFromStateRef.current = getActionFromState;
|
|
164
142
|
});
|
|
165
143
|
|
|
144
|
+
const validateRoutesNotExistInRootState = React.useCallback(
|
|
145
|
+
(state: ResultState) => {
|
|
146
|
+
const navigation = ref.current;
|
|
147
|
+
const rootState = navigation?.getRootState();
|
|
148
|
+
// Make sure that the routes in the state exist in the root navigator
|
|
149
|
+
// Otherwise there's an error in the linking configuration
|
|
150
|
+
return state?.routes.some((r) => !rootState?.routeNames.includes(r.name));
|
|
151
|
+
},
|
|
152
|
+
[ref]
|
|
153
|
+
);
|
|
154
|
+
|
|
166
155
|
const server = React.useContext(ServerContext);
|
|
167
156
|
|
|
168
157
|
const getInitialState = React.useCallback(() => {
|
|
@@ -178,6 +167,9 @@ export default function useLinking(
|
|
|
178
167
|
if (path) {
|
|
179
168
|
value = getStateFromPathRef.current(path, configRef.current);
|
|
180
169
|
}
|
|
170
|
+
|
|
171
|
+
// If the link were handled, it gets cleared in NavigationContainer
|
|
172
|
+
onUnhandledLinking(path);
|
|
181
173
|
}
|
|
182
174
|
|
|
183
175
|
const thenable = {
|
|
@@ -207,6 +199,8 @@ export default function useLinking(
|
|
|
207
199
|
return;
|
|
208
200
|
}
|
|
209
201
|
|
|
202
|
+
const { location } = window;
|
|
203
|
+
|
|
210
204
|
const path = location.pathname + location.search;
|
|
211
205
|
const index = history.index;
|
|
212
206
|
|
|
@@ -230,14 +224,11 @@ export default function useLinking(
|
|
|
230
224
|
// We should only dispatch an action when going forward
|
|
231
225
|
// Otherwise the action will likely add items to history, which would mess things up
|
|
232
226
|
if (state) {
|
|
227
|
+
// If the link were handled, it gets cleared in NavigationContainer
|
|
228
|
+
onUnhandledLinking(path);
|
|
233
229
|
// Make sure that the routes in the state exist in the root navigator
|
|
234
230
|
// Otherwise there's an error in the linking configuration
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {
|
|
238
|
-
console.warn(
|
|
239
|
-
"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration."
|
|
240
|
-
);
|
|
231
|
+
if (validateRoutesNotExistInRootState(state)) {
|
|
241
232
|
return;
|
|
242
233
|
}
|
|
243
234
|
|
|
@@ -272,7 +263,13 @@ export default function useLinking(
|
|
|
272
263
|
navigation.resetRoot(state);
|
|
273
264
|
}
|
|
274
265
|
});
|
|
275
|
-
}, [
|
|
266
|
+
}, [
|
|
267
|
+
enabled,
|
|
268
|
+
history,
|
|
269
|
+
onUnhandledLinking,
|
|
270
|
+
ref,
|
|
271
|
+
validateRoutesNotExistInRootState,
|
|
272
|
+
]);
|
|
276
273
|
|
|
277
274
|
React.useEffect(() => {
|
|
278
275
|
if (!enabled) {
|
|
@@ -381,7 +378,12 @@ export default function useLinking(
|
|
|
381
378
|
const currentIndex = history.index;
|
|
382
379
|
|
|
383
380
|
try {
|
|
384
|
-
if (
|
|
381
|
+
if (
|
|
382
|
+
nextIndex !== -1 &&
|
|
383
|
+
nextIndex < currentIndex &&
|
|
384
|
+
// We should only go back if the entry exists and it's less than current index
|
|
385
|
+
history.get(nextIndex - currentIndex)
|
|
386
|
+
) {
|
|
385
387
|
// An existing entry for this path exists and it's less than current index, go back to that
|
|
386
388
|
await history.go(nextIndex - currentIndex);
|
|
387
389
|
} else {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { LocaleDirContext } from './LocaleDirContext';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Hook to access the text direction specified in the `NavigationContainer`.
|
|
7
|
+
*/
|
|
8
|
+
export function useLocale() {
|
|
9
|
+
const direction = React.useContext(LocaleDirContext);
|
|
10
|
+
|
|
11
|
+
if (direction === undefined) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"Couldn't determine the text direction. Is your component inside NavigationContainer?"
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return { direction };
|
|
18
|
+
}
|
package/src/useScrollToTop.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
EventArg,
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type EventArg,
|
|
3
|
+
NavigationContext,
|
|
4
|
+
type NavigationProp,
|
|
5
|
+
type ParamListBase,
|
|
5
6
|
useRoute,
|
|
6
7
|
} from '@react-navigation/core';
|
|
7
8
|
import * as React from 'react';
|
|
@@ -48,16 +49,19 @@ function getScrollableNode(ref: React.RefObject<ScrollableWrapper>) {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
) {
|
|
54
|
-
const navigation = useNavigation();
|
|
52
|
+
export function useScrollToTop(ref: React.RefObject<ScrollableWrapper>) {
|
|
53
|
+
const navigation = React.useContext(NavigationContext);
|
|
55
54
|
const route = useRoute();
|
|
56
55
|
|
|
56
|
+
if (navigation === undefined) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
"Couldn't find a navigation object. Is your component inside NavigationContainer?"
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
React.useEffect(() => {
|
|
58
|
-
|
|
63
|
+
const tabNavigations: NavigationProp<ParamListBase>[] = [];
|
|
59
64
|
let currentNavigation = navigation;
|
|
60
|
-
|
|
61
65
|
// If the screen is nested inside multiple tab navigators, we should scroll to top for any of them
|
|
62
66
|
// So we need to find all the parent tab navigators and add the listeners there
|
|
63
67
|
while (currentNavigation) {
|
|
@@ -76,7 +80,7 @@ export default function useScrollToTop(
|
|
|
76
80
|
return tab.addListener(
|
|
77
81
|
// We don't wanna import tab types here to avoid extra deps
|
|
78
82
|
// in addition, there are multiple tab implementations
|
|
79
|
-
// @ts-expect-error
|
|
83
|
+
// @ts-expect-error the `tabPress` event is only available when navigation type is tab
|
|
80
84
|
'tabPress',
|
|
81
85
|
(e: EventArg<'tabPress', true>) => {
|
|
82
86
|
// We should scroll to top only when the screen is focused
|
package/src/useThenable.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function useThenable<T>(create: () => PromiseLike<T>) {
|
|
4
4
|
const [promise] = React.useState(create);
|
|
5
5
|
|
|
6
6
|
let initialState: [boolean, T | undefined] = [false, undefined];
|
|
7
7
|
|
|
8
8
|
// Check if our thenable is synchronous
|
|
9
|
+
// eslint-disable-next-line promise/catch-or-return, promise/always-return
|
|
9
10
|
promise.then((result) => {
|
|
10
11
|
initialState = [true, result];
|
|
11
12
|
});
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _DefaultTheme = _interopRequireDefault(require("./DefaultTheme"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
12
|
-
const ThemeContext = /*#__PURE__*/React.createContext(_DefaultTheme.default);
|
|
13
|
-
ThemeContext.displayName = 'ThemeContext';
|
|
14
|
-
var _default = ThemeContext;
|
|
15
|
-
exports.default = _default;
|
|
16
|
-
//# sourceMappingURL=ThemeContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = ThemeProvider;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ThemeContext = _interopRequireDefault(require("./ThemeContext"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
12
|
-
function ThemeProvider(_ref) {
|
|
13
|
-
let {
|
|
14
|
-
value,
|
|
15
|
-
children
|
|
16
|
-
} = _ref;
|
|
17
|
-
return /*#__PURE__*/React.createElement(_ThemeContext.default.Provider, {
|
|
18
|
-
value: value
|
|
19
|
-
}, children);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useTheme;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _ThemeContext = _interopRequireDefault(require("./ThemeContext"));
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
12
|
-
function useTheme() {
|
|
13
|
-
const theme = React.useContext(_ThemeContext.default);
|
|
14
|
-
return theme;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=useTheme.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useLinkTools;
|
|
7
|
-
var _core = require("@react-navigation/core");
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _LinkingContext = _interopRequireDefault(require("./LinkingContext"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
13
|
-
const getRootStateForNavigate = (navigation, state) => {
|
|
14
|
-
const parent = navigation.getParent();
|
|
15
|
-
if (parent) {
|
|
16
|
-
const parentState = parent.getState();
|
|
17
|
-
return getRootStateForNavigate(parent, {
|
|
18
|
-
index: 0,
|
|
19
|
-
routes: [{
|
|
20
|
-
...parentState.routes[parentState.index],
|
|
21
|
-
state: state
|
|
22
|
-
}]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return state;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Build destination link for a navigate action.
|
|
30
|
-
* Useful for showing anchor tags on the web for buttons that perform navigation.
|
|
31
|
-
*/
|
|
32
|
-
function useLinkTools() {
|
|
33
|
-
const navigation = React.useContext(_core.NavigationHelpersContext);
|
|
34
|
-
const linking = React.useContext(_LinkingContext.default);
|
|
35
|
-
const buildHref = React.useCallback((name, params) => {
|
|
36
|
-
const {
|
|
37
|
-
options
|
|
38
|
-
} = linking;
|
|
39
|
-
if ((options === null || options === void 0 ? void 0 : options.enabled) === false) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
const state = navigation ? getRootStateForNavigate(navigation, {
|
|
43
|
-
index: 0,
|
|
44
|
-
routes: [{
|
|
45
|
-
name,
|
|
46
|
-
params
|
|
47
|
-
}]
|
|
48
|
-
}) :
|
|
49
|
-
// If we couldn't find a navigation object in context, we're at root
|
|
50
|
-
// So we'll construct a basic state object to use
|
|
51
|
-
{
|
|
52
|
-
index: 0,
|
|
53
|
-
routes: [{
|
|
54
|
-
name,
|
|
55
|
-
params
|
|
56
|
-
}]
|
|
57
|
-
};
|
|
58
|
-
const path = options !== null && options !== void 0 && options.getPathFromState ? options.getPathFromState(state, options === null || options === void 0 ? void 0 : options.config) : (0, _core.getPathFromState)(state, options === null || options === void 0 ? void 0 : options.config);
|
|
59
|
-
return path;
|
|
60
|
-
}, [linking, navigation]);
|
|
61
|
-
const buildAction = React.useCallback(href => {
|
|
62
|
-
if (!href.startsWith('/')) {
|
|
63
|
-
throw new Error(`The path must start with '/' (${href}).`);
|
|
64
|
-
}
|
|
65
|
-
const {
|
|
66
|
-
options
|
|
67
|
-
} = linking;
|
|
68
|
-
const state = options !== null && options !== void 0 && options.getStateFromPath ? options.getStateFromPath(href, options.config) : (0, _core.getStateFromPath)(href, options === null || options === void 0 ? void 0 : options.config);
|
|
69
|
-
if (state) {
|
|
70
|
-
const action = (0, _core.getActionFromState)(state, options === null || options === void 0 ? void 0 : options.config);
|
|
71
|
-
return action ?? _core.CommonActions.reset(state);
|
|
72
|
-
} else {
|
|
73
|
-
throw new Error('Failed to parse the path to a navigation state.');
|
|
74
|
-
}
|
|
75
|
-
}, [linking]);
|
|
76
|
-
return {
|
|
77
|
-
buildHref,
|
|
78
|
-
buildAction
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=useLinkTools.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getRootStateForNavigate","navigation","state","parent","getParent","parentState","getState","index","routes","useLinkTools","React","useContext","NavigationHelpersContext","linking","LinkingContext","buildHref","useCallback","name","params","options","enabled","undefined","path","getPathFromState","config","buildAction","href","startsWith","Error","getStateFromPath","action","getActionFromState","CommonActions","reset"],"sourceRoot":"../../src","sources":["useLinkTools.tsx"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","DefaultTheme","ThemeContext","createContext","displayName"],"sourceRoot":"../../src","sources":["ThemeContext.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,MAAMC,YAAY,gBAAGF,KAAK,CAACG,aAAa,CAAQF,YAAY,CAAC;AAE7DC,YAAY,CAACE,WAAW,GAAG,cAAc;AAEzC,eAAeF,YAAY"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import ThemeContext from './ThemeContext';
|
|
3
|
-
export default function ThemeProvider(_ref) {
|
|
4
|
-
let {
|
|
5
|
-
value,
|
|
6
|
-
children
|
|
7
|
-
} = _ref;
|
|
8
|
-
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
|
9
|
-
value: value
|
|
10
|
-
}, children);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=ThemeProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","ThemeContext","ThemeProvider","value","children"],"sourceRoot":"../../src","sources":["ThemeProvider.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,OAAOC,YAAY,MAAM,gBAAgB;AAOzC,eAAe,SAASC,aAAa,OAA6B;EAAA,IAA5B;IAAEC,KAAK;IAAEC;EAAgB,CAAC;EAC9D,oBACE,oBAAC,YAAY,CAAC,QAAQ;IAAC,KAAK,EAAED;EAAM,GAAEC,QAAQ,CAAyB;AAE3E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","ThemeContext","useTheme","theme","useContext"],"sourceRoot":"../../src","sources":["useTheme.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,eAAe,SAASC,QAAQ,GAAG;EACjC,MAAMC,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACH,YAAY,CAAC;EAE5C,OAAOE,KAAK;AACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CommonActions","getActionFromState","getPathFromState","getStateFromPath","NavigationHelpersContext","React","LinkingContext","getRootStateForNavigate","navigation","state","parent","getParent","parentState","getState","index","routes","useLinkTools","useContext","linking","buildHref","useCallback","name","params","options","enabled","undefined","path","config","buildAction","href","startsWith","Error","action","reset"],"sourceRoot":"../../src","sources":["useLinkTools.tsx"],"mappings":"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"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare const createStackNavigator: {
|
|
3
|
-
<ParamList extends import("@react-navigation/core").ParamListBase>(): import("@react-navigation/core").TypedNavigator<ParamList, Readonly<{
|
|
4
|
-
key: string;
|
|
5
|
-
index: number;
|
|
6
|
-
routeNames: string[];
|
|
7
|
-
history?: unknown[] | undefined;
|
|
8
|
-
routes: (Readonly<{
|
|
9
|
-
key: string;
|
|
10
|
-
name: string;
|
|
11
|
-
path?: string | undefined;
|
|
12
|
-
}> & Readonly<{
|
|
13
|
-
params?: Readonly<object | undefined>;
|
|
14
|
-
}> & {
|
|
15
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
16
|
-
})[];
|
|
17
|
-
type: string;
|
|
18
|
-
stale: false;
|
|
19
|
-
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => JSX.Element>;
|
|
20
|
-
<ParamList_1 extends import("@react-navigation/core").ParamListBase, Config extends import("packages/core/lib/typescript/src/StaticNavigation").StaticConfig<ParamList_1, Readonly<{
|
|
21
|
-
key: string;
|
|
22
|
-
index: number;
|
|
23
|
-
routeNames: string[];
|
|
24
|
-
history?: unknown[] | undefined;
|
|
25
|
-
routes: (Readonly<{
|
|
26
|
-
key: string;
|
|
27
|
-
name: string;
|
|
28
|
-
path?: string | undefined;
|
|
29
|
-
}> & Readonly<{
|
|
30
|
-
params?: Readonly<object | undefined>;
|
|
31
|
-
}> & {
|
|
32
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
33
|
-
})[];
|
|
34
|
-
type: string;
|
|
35
|
-
stale: false;
|
|
36
|
-
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => JSX.Element>>(config: Config): import("@react-navigation/core").TypedNavigator<ParamList_1, Readonly<{
|
|
37
|
-
key: string;
|
|
38
|
-
index: number;
|
|
39
|
-
routeNames: string[];
|
|
40
|
-
history?: unknown[] | undefined;
|
|
41
|
-
routes: (Readonly<{
|
|
42
|
-
key: string;
|
|
43
|
-
name: string;
|
|
44
|
-
path?: string | undefined;
|
|
45
|
-
}> & Readonly<{
|
|
46
|
-
params?: Readonly<object | undefined>;
|
|
47
|
-
}> & {
|
|
48
|
-
state?: Readonly<any> | import("@react-navigation/core").PartialState<Readonly<any>> | undefined;
|
|
49
|
-
})[];
|
|
50
|
-
type: string;
|
|
51
|
-
stale: false;
|
|
52
|
-
}>, {}, import("@react-navigation/core").EventMapBase, (props: any) => JSX.Element> & {
|
|
53
|
-
config: Config;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export default createStackNavigator;
|
|
57
|
-
//# sourceMappingURL=createStackNavigator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStackNavigator.d.ts","sourceRoot":"","sources":["../../../../src/__mocks__/createStackNavigator.tsx"],"names":[],"mappings":";AAOA,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWxB,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/__mocks__/window.tsx"],"names":[],"mappings":"AAiEA,QAAA,MAAM,MAAM;;;;;;;yBApDO,GAAG,KAAK,MAAM,QAAQ,MAAM;4BASzB,GAAG,KAAK,MAAM,QAAQ,MAAM;cAO1C,MAAM;;;;6BAwBkB,UAAU,YAAY,MAAM,IAAI;gCAM7B,UAAU,YAAY,MAAM,IAAI;;CAelE,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeContext.d.ts","sourceRoot":"","sources":["../../../../src/theming/ThemeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGtC,QAAA,MAAM,YAAY,sBAA2C,CAAC;AAI9D,eAAe,YAAY,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { Theme } from '../types';
|
|
3
|
-
type Props = {
|
|
4
|
-
value: Theme;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export default function ThemeProvider({ value, children }: Props): JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/theming/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGtC,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,eAI/D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../src/theming/useTheme.tsx"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,QAAQ,uBAI/B"}
|