@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.
Files changed (238) hide show
  1. package/lib/commonjs/Link.js +16 -9
  2. package/lib/commonjs/Link.js.map +1 -1
  3. package/lib/commonjs/LinkingContext.js +8 -7
  4. package/lib/commonjs/LinkingContext.js.map +1 -1
  5. package/lib/commonjs/LocaleDirContext.js +12 -0
  6. package/lib/commonjs/LocaleDirContext.js.map +1 -0
  7. package/lib/commonjs/NavigationContainer.js +68 -32
  8. package/lib/commonjs/NavigationContainer.js.map +1 -1
  9. package/lib/commonjs/ServerContainer.js +6 -8
  10. package/lib/commonjs/ServerContainer.js.map +1 -1
  11. package/lib/commonjs/ServerContext.js +4 -6
  12. package/lib/commonjs/ServerContext.js.map +1 -1
  13. package/lib/commonjs/UnhandledLinkingContext.js +20 -0
  14. package/lib/commonjs/UnhandledLinkingContext.js.map +1 -0
  15. package/lib/commonjs/__stubs__/createStackNavigator.js +19 -0
  16. package/lib/commonjs/__stubs__/createStackNavigator.js.map +1 -0
  17. package/lib/commonjs/__stubs__/window.js +79 -0
  18. package/lib/commonjs/__stubs__/window.js.map +1 -0
  19. package/lib/commonjs/createMemoryHistory.js +5 -8
  20. package/lib/commonjs/createMemoryHistory.js.map +1 -1
  21. package/lib/commonjs/createStaticNavigation.js +8 -8
  22. package/lib/commonjs/createStaticNavigation.js.map +1 -1
  23. package/lib/commonjs/extractPathFromURL.js +4 -4
  24. package/lib/commonjs/extractPathFromURL.js.map +1 -1
  25. package/lib/commonjs/index.js +33 -34
  26. package/lib/commonjs/index.js.map +1 -1
  27. package/lib/commonjs/theming/DarkTheme.js +5 -5
  28. package/lib/commonjs/theming/DarkTheme.js.map +1 -1
  29. package/lib/commonjs/theming/DefaultTheme.js +5 -5
  30. package/lib/commonjs/theming/DefaultTheme.js.map +1 -1
  31. package/lib/commonjs/theming/fonts.js +65 -0
  32. package/lib/commonjs/theming/fonts.js.map +1 -0
  33. package/lib/commonjs/types.js.map +1 -1
  34. package/lib/commonjs/useBackButton.js +4 -20
  35. package/lib/commonjs/useBackButton.js.map +1 -1
  36. package/lib/commonjs/useBackButton.native.js +27 -0
  37. package/lib/commonjs/useBackButton.native.js.map +1 -0
  38. package/lib/commonjs/useDocumentTitle.js +6 -6
  39. package/lib/commonjs/useDocumentTitle.js.map +1 -1
  40. package/lib/commonjs/useDocumentTitle.native.js +1 -1
  41. package/lib/commonjs/useDocumentTitle.native.js.map +1 -1
  42. package/lib/commonjs/useLinkBuilder.js +80 -0
  43. package/lib/commonjs/useLinkBuilder.js.map +1 -0
  44. package/lib/commonjs/useLinkProps.js +23 -27
  45. package/lib/commonjs/useLinkProps.js.map +1 -1
  46. package/lib/commonjs/useLinkTo.js +30 -0
  47. package/lib/commonjs/useLinkTo.js.map +1 -0
  48. package/lib/commonjs/useLinking.js +39 -40
  49. package/lib/commonjs/useLinking.js.map +1 -1
  50. package/lib/commonjs/useLinking.native.js +33 -27
  51. package/lib/commonjs/useLinking.native.js.map +1 -1
  52. package/lib/commonjs/useLocale.js +23 -0
  53. package/lib/commonjs/useLocale.js.map +1 -0
  54. package/lib/commonjs/useScrollToTop.js +9 -7
  55. package/lib/commonjs/useScrollToTop.js.map +1 -1
  56. package/lib/commonjs/useThenable.js +4 -3
  57. package/lib/commonjs/useThenable.js.map +1 -1
  58. package/lib/commonjs/useUnhandledLinking.js +75 -0
  59. package/lib/commonjs/useUnhandledLinking.js.map +1 -0
  60. package/lib/module/Link.js +13 -5
  61. package/lib/module/Link.js.map +1 -1
  62. package/lib/module/LinkingContext.js +5 -3
  63. package/lib/module/LinkingContext.js.map +1 -1
  64. package/lib/module/LocaleDirContext.js +4 -0
  65. package/lib/module/LocaleDirContext.js.map +1 -0
  66. package/lib/module/NavigationContainer.js +60 -23
  67. package/lib/module/NavigationContainer.js.map +1 -1
  68. package/lib/module/ServerContainer.js +2 -2
  69. package/lib/module/ServerContainer.js.map +1 -1
  70. package/lib/module/ServerContext.js +1 -2
  71. package/lib/module/ServerContext.js.map +1 -1
  72. package/lib/module/UnhandledLinkingContext.js +12 -0
  73. package/lib/module/UnhandledLinkingContext.js.map +1 -0
  74. package/lib/module/__stubs__/createStackNavigator.js +11 -0
  75. package/lib/module/__stubs__/createStackNavigator.js.map +1 -0
  76. package/lib/module/__stubs__/window.js +73 -0
  77. package/lib/module/__stubs__/window.js.map +1 -0
  78. package/lib/module/createMemoryHistory.js +5 -8
  79. package/lib/module/createMemoryHistory.js.map +1 -1
  80. package/lib/module/createStaticNavigation.js +5 -4
  81. package/lib/module/createStaticNavigation.js.map +1 -1
  82. package/lib/module/extractPathFromURL.js +4 -4
  83. package/lib/module/extractPathFromURL.js.map +1 -1
  84. package/lib/module/index.js +12 -12
  85. package/lib/module/index.js.map +1 -1
  86. package/lib/module/theming/DarkTheme.js +4 -3
  87. package/lib/module/theming/DarkTheme.js.map +1 -1
  88. package/lib/module/theming/DefaultTheme.js +4 -3
  89. package/lib/module/theming/DefaultTheme.js.map +1 -1
  90. package/lib/module/theming/fonts.js +59 -0
  91. package/lib/module/theming/fonts.js.map +1 -0
  92. package/lib/module/types.js.map +1 -1
  93. package/lib/module/useBackButton.js +3 -17
  94. package/lib/module/useBackButton.js.map +1 -1
  95. package/lib/module/useBackButton.native.js +19 -0
  96. package/lib/module/useBackButton.native.js.map +1 -0
  97. package/lib/module/useDocumentTitle.js +4 -4
  98. package/lib/module/useDocumentTitle.js.map +1 -1
  99. package/lib/module/useDocumentTitle.native.js +1 -1
  100. package/lib/module/useDocumentTitle.native.js.map +1 -1
  101. package/lib/module/{useLinkTools.js → useLinkBuilder.js} +11 -11
  102. package/lib/module/useLinkBuilder.js.map +1 -0
  103. package/lib/module/useLinkProps.js +20 -23
  104. package/lib/module/useLinkProps.js.map +1 -1
  105. package/lib/module/useLinkTo.js +23 -0
  106. package/lib/module/useLinkTo.js.map +1 -0
  107. package/lib/module/useLinking.js +33 -36
  108. package/lib/module/useLinking.js.map +1 -1
  109. package/lib/module/useLinking.native.js +29 -22
  110. package/lib/module/useLinking.native.js.map +1 -1
  111. package/lib/module/useLocale.js +16 -0
  112. package/lib/module/useLocale.js.map +1 -0
  113. package/lib/module/useScrollToTop.js +8 -6
  114. package/lib/module/useScrollToTop.js.map +1 -1
  115. package/lib/module/useThenable.js +2 -1
  116. package/lib/module/useThenable.js.map +1 -1
  117. package/lib/module/useUnhandledLinking.js +69 -0
  118. package/lib/module/useUnhandledLinking.js.map +1 -0
  119. package/lib/typescript/src/Link.d.ts +3 -3
  120. package/lib/typescript/src/Link.d.ts.map +1 -1
  121. package/lib/typescript/src/LinkingContext.d.ts +2 -3
  122. package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
  123. package/lib/typescript/src/LocaleDirContext.d.ts +4 -0
  124. package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -0
  125. package/lib/typescript/src/NavigationContainer.d.ts +6 -6
  126. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  127. package/lib/typescript/src/ServerContainer.d.ts +2 -3
  128. package/lib/typescript/src/ServerContainer.d.ts.map +1 -1
  129. package/lib/typescript/src/ServerContext.d.ts +1 -2
  130. package/lib/typescript/src/ServerContext.d.ts.map +1 -1
  131. package/lib/typescript/src/UnhandledLinkingContext.d.ts +6 -0
  132. package/lib/typescript/src/UnhandledLinkingContext.d.ts.map +1 -0
  133. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +32 -0
  134. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -0
  135. package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts +2 -3
  136. package/lib/typescript/src/__stubs__/window.d.ts.map +1 -0
  137. package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
  138. package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -1
  139. package/lib/typescript/src/createStaticNavigation.d.ts +3 -3
  140. package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
  141. package/lib/typescript/src/extractPathFromURL.d.ts +1 -1
  142. package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
  143. package/lib/typescript/src/index.d.ts +12 -12
  144. package/lib/typescript/src/index.d.ts.map +1 -1
  145. package/lib/typescript/src/theming/DarkTheme.d.ts +1 -2
  146. package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
  147. package/lib/typescript/src/theming/DefaultTheme.d.ts +1 -2
  148. package/lib/typescript/src/theming/DefaultTheme.d.ts.map +1 -1
  149. package/lib/typescript/src/theming/fonts.d.ts +53 -0
  150. package/lib/typescript/src/theming/fonts.d.ts.map +1 -0
  151. package/lib/typescript/src/types.d.ts +41 -11
  152. package/lib/typescript/src/types.d.ts.map +1 -1
  153. package/lib/typescript/src/useBackButton.d.ts +2 -2
  154. package/lib/typescript/src/useBackButton.d.ts.map +1 -1
  155. package/lib/typescript/src/useBackButton.native.d.ts +4 -0
  156. package/lib/typescript/src/useBackButton.native.d.ts.map +1 -0
  157. package/lib/typescript/src/useDocumentTitle.d.ts +1 -1
  158. package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
  159. package/lib/typescript/src/useDocumentTitle.native.d.ts +1 -1
  160. package/lib/typescript/src/useDocumentTitle.native.d.ts.map +1 -1
  161. package/lib/typescript/src/useLinkBuilder.d.ts +25 -0
  162. package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -0
  163. package/lib/typescript/src/useLinkProps.d.ts +3 -3
  164. package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
  165. package/lib/typescript/src/useLinkTo.d.ts +6 -0
  166. package/lib/typescript/src/useLinkTo.d.ts.map +1 -0
  167. package/lib/typescript/src/useLinking.d.ts +8 -20
  168. package/lib/typescript/src/useLinking.d.ts.map +1 -1
  169. package/lib/typescript/src/useLinking.native.d.ts +4 -20
  170. package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
  171. package/lib/typescript/src/useLocale.d.ts +7 -0
  172. package/lib/typescript/src/useLocale.d.ts.map +1 -0
  173. package/lib/typescript/src/useScrollToTop.d.ts +1 -1
  174. package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
  175. package/lib/typescript/src/useThenable.d.ts +1 -1
  176. package/lib/typescript/src/useThenable.d.ts.map +1 -1
  177. package/lib/typescript/src/useUnhandledLinking.d.ts +7 -0
  178. package/lib/typescript/src/useUnhandledLinking.d.ts.map +1 -0
  179. package/package.json +15 -15
  180. package/src/Link.tsx +12 -3
  181. package/src/LinkingContext.tsx +9 -5
  182. package/src/LocaleDirContext.tsx +7 -0
  183. package/src/NavigationContainer.tsx +90 -36
  184. package/src/ServerContainer.tsx +2 -2
  185. package/src/ServerContext.tsx +1 -3
  186. package/src/UnhandledLinkingContext.tsx +18 -0
  187. package/src/{__mocks__ → __stubs__}/createStackNavigator.tsx +1 -3
  188. package/src/{__mocks__ → __stubs__}/window.tsx +8 -8
  189. package/src/createMemoryHistory.tsx +1 -1
  190. package/src/createStaticNavigation.tsx +8 -8
  191. package/src/extractPathFromURL.tsx +5 -2
  192. package/src/index.tsx +12 -12
  193. package/src/theming/DarkTheme.tsx +3 -3
  194. package/src/theming/DefaultTheme.tsx +3 -3
  195. package/src/theming/fonts.tsx +63 -0
  196. package/src/types.tsx +55 -11
  197. package/src/useBackButton.native.tsx +33 -0
  198. package/src/useBackButton.tsx +4 -26
  199. package/src/useDocumentTitle.native.tsx +1 -1
  200. package/src/useDocumentTitle.tsx +1 -1
  201. package/src/{useLinkTools.tsx → useLinkBuilder.tsx} +9 -9
  202. package/src/useLinkProps.tsx +27 -23
  203. package/src/useLinkTo.tsx +30 -0
  204. package/src/useLinking.native.tsx +28 -22
  205. package/src/useLinking.tsx +46 -44
  206. package/src/useLocale.tsx +18 -0
  207. package/src/useScrollToTop.tsx +14 -10
  208. package/src/useThenable.tsx +2 -1
  209. package/src/useUnhandledLinking.tsx +91 -0
  210. package/lib/commonjs/theming/ThemeContext.js +0 -16
  211. package/lib/commonjs/theming/ThemeContext.js.map +0 -1
  212. package/lib/commonjs/theming/ThemeProvider.js +0 -21
  213. package/lib/commonjs/theming/ThemeProvider.js.map +0 -1
  214. package/lib/commonjs/theming/useTheme.js +0 -16
  215. package/lib/commonjs/theming/useTheme.js.map +0 -1
  216. package/lib/commonjs/useLinkTools.js +0 -81
  217. package/lib/commonjs/useLinkTools.js.map +0 -1
  218. package/lib/module/theming/ThemeContext.js +0 -6
  219. package/lib/module/theming/ThemeContext.js.map +0 -1
  220. package/lib/module/theming/ThemeProvider.js +0 -12
  221. package/lib/module/theming/ThemeProvider.js.map +0 -1
  222. package/lib/module/theming/useTheme.js +0 -7
  223. package/lib/module/theming/useTheme.js.map +0 -1
  224. package/lib/module/useLinkTools.js.map +0 -1
  225. package/lib/typescript/src/__mocks__/createStackNavigator.d.ts +0 -57
  226. package/lib/typescript/src/__mocks__/createStackNavigator.d.ts.map +0 -1
  227. package/lib/typescript/src/__mocks__/window.d.ts.map +0 -1
  228. package/lib/typescript/src/theming/ThemeContext.d.ts +0 -5
  229. package/lib/typescript/src/theming/ThemeContext.d.ts.map +0 -1
  230. package/lib/typescript/src/theming/ThemeProvider.d.ts +0 -9
  231. package/lib/typescript/src/theming/ThemeProvider.d.ts.map +0 -1
  232. package/lib/typescript/src/theming/useTheme.d.ts +0 -2
  233. package/lib/typescript/src/theming/useTheme.d.ts.map +0 -1
  234. package/lib/typescript/src/useLinkTools.d.ts +0 -33
  235. package/lib/typescript/src/useLinkTools.d.ts.map +0 -1
  236. package/src/theming/ThemeContext.tsx +0 -10
  237. package/src/theming/ThemeProvider.tsx +0 -15
  238. package/src/theming/useTheme.tsx +0 -9
@@ -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
- // Whether we're currently handling a callback
65
- let handling = false;
66
- let queue: (() => Promise<void>)[] = [];
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
- let linkingHandlers: Symbol[] = [];
72
+ const linkingHandlers: symbol[] = [];
96
73
 
97
74
  type Options = LinkingOptions<ParamListBase>;
98
75
 
99
- export default function useLinking(
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
- const rootState = navigation.getRootState();
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
- }, [enabled, history, ref]);
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 (nextIndex !== -1 && nextIndex < currentIndex) {
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
+ }
@@ -1,7 +1,8 @@
1
1
  import {
2
- EventArg,
3
- NavigationProp,
4
- useNavigation,
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 default function useScrollToTop(
52
- ref: React.RefObject<ScrollableWrapper>
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
- let tabNavigations: NavigationProp<ReactNavigation.RootParamList>[] = [];
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
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
 
3
- export default function useThenable<T>(create: () => PromiseLike<T>) {
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,6 +0,0 @@
1
- import * as React from 'react';
2
- import DefaultTheme from './DefaultTheme';
3
- const ThemeContext = /*#__PURE__*/React.createContext(DefaultTheme);
4
- ThemeContext.displayName = 'ThemeContext';
5
- export default ThemeContext;
6
- //# sourceMappingURL=ThemeContext.js.map
@@ -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,7 +0,0 @@
1
- import * as React from 'react';
2
- import ThemeContext from './ThemeContext';
3
- export default function useTheme() {
4
- const theme = React.useContext(ThemeContext);
5
- return theme;
6
- }
7
- //# sourceMappingURL=useTheme.js.map
@@ -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,5 +0,0 @@
1
- import * as React from 'react';
2
- import type { Theme } from '../types';
3
- declare const ThemeContext: React.Context<Theme>;
4
- export default ThemeContext;
5
- //# sourceMappingURL=ThemeContext.d.ts.map
@@ -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,2 +0,0 @@
1
- export default function useTheme(): import("..").Theme;
2
- //# sourceMappingURL=useTheme.d.ts.map
@@ -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"}