@amazon-devices/react-navigation__native 7.0.9000000000 → 8.0.9000000000-rn-83

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 (232) hide show
  1. package/SystemBundles/c0d77be093c9724f49566be215c67240e6443c16760f772a745108ddaef15503.bundle +9117 -0
  2. package/SystemBundles/c0d77be093c9724f49566be215c67240e6443c16760f772a745108ddaef15503.map +3543 -0
  3. package/SystemModules/amzn__react-navigation__native-8.modules.txt +24 -0
  4. package/SystemModules/amzn__react-navigation__native-8.private.modules.txt +77 -0
  5. package/SystemModules/keplerscript-system-bundle-config.json +4 -4
  6. package/kepler-compatibility.json +2 -2
  7. package/lib/module/Link.js +31 -10
  8. package/lib/module/Link.js.map +1 -1
  9. package/lib/module/LinkingContext.js +7 -3
  10. package/lib/module/LinkingContext.js.map +1 -1
  11. package/lib/module/LocaleDirContext.js +6 -0
  12. package/lib/module/LocaleDirContext.js.map +1 -0
  13. package/lib/module/NavigationContainer.js +87 -59
  14. package/lib/module/NavigationContainer.js.map +1 -1
  15. package/lib/module/ServerContainer.js +20 -10
  16. package/lib/module/ServerContainer.js.map +1 -1
  17. package/lib/module/ServerContext.js +3 -2
  18. package/lib/module/ServerContext.js.map +1 -1
  19. package/lib/module/UnhandledLinkingContext.js +14 -0
  20. package/lib/module/UnhandledLinkingContext.js.map +1 -0
  21. package/lib/module/__stubs__/createStackNavigator.js +18 -0
  22. package/lib/module/__stubs__/createStackNavigator.js.map +1 -0
  23. package/lib/module/__stubs__/window.js +75 -0
  24. package/lib/module/__stubs__/window.js.map +1 -0
  25. package/lib/module/createMemoryHistory.js +19 -17
  26. package/lib/module/createMemoryHistory.js.map +1 -1
  27. package/lib/module/createStaticNavigation.js +54 -0
  28. package/lib/module/createStaticNavigation.js.map +1 -0
  29. package/lib/module/extractPathFromURL.js +6 -5
  30. package/lib/module/extractPathFromURL.js.map +1 -1
  31. package/lib/module/index.js +18 -13
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/package.json +1 -0
  34. package/lib/module/theming/DarkTheme.js +6 -3
  35. package/lib/module/theming/DarkTheme.js.map +1 -1
  36. package/lib/module/theming/DefaultTheme.js +6 -3
  37. package/lib/module/theming/DefaultTheme.js.map +1 -1
  38. package/lib/module/theming/fonts.js +61 -0
  39. package/lib/module/theming/fonts.js.map +1 -0
  40. package/lib/module/types.js +2 -0
  41. package/lib/module/types.js.map +1 -1
  42. package/lib/module/useBackButton.js +3 -1
  43. package/lib/module/useBackButton.js.map +1 -1
  44. package/lib/module/useBackButton.native.js +3 -1
  45. package/lib/module/useBackButton.native.js.map +1 -1
  46. package/lib/module/useDocumentTitle.js +6 -4
  47. package/lib/module/useDocumentTitle.js.map +1 -1
  48. package/lib/module/useDocumentTitle.native.js +4 -2
  49. package/lib/module/useDocumentTitle.native.js.map +1 -1
  50. package/lib/module/useLinkBuilder.js +71 -40
  51. package/lib/module/useLinkBuilder.js.map +1 -1
  52. package/lib/module/useLinkProps.js +41 -36
  53. package/lib/module/useLinkProps.js.map +1 -1
  54. package/lib/module/useLinkTo.js +18 -28
  55. package/lib/module/useLinkTo.js.map +1 -1
  56. package/lib/module/useLinking.js +47 -19
  57. package/lib/module/useLinking.js.map +1 -1
  58. package/lib/module/useLinking.native.js +33 -28
  59. package/lib/module/useLinking.native.js.map +1 -1
  60. package/lib/module/useLocale.js +18 -0
  61. package/lib/module/useLocale.js.map +1 -0
  62. package/lib/module/useRoutePath.js +30 -0
  63. package/lib/module/useRoutePath.js.map +1 -0
  64. package/lib/module/useScrollToTop.js +11 -7
  65. package/lib/module/useScrollToTop.js.map +1 -1
  66. package/lib/module/useThenable.js +4 -1
  67. package/lib/module/useThenable.js.map +1 -1
  68. package/lib/typescript/package.json +1 -0
  69. package/lib/typescript/src/Link.d.ts +8 -10
  70. package/lib/typescript/src/Link.d.ts.map +1 -1
  71. package/lib/typescript/src/LinkingContext.d.ts +2 -3
  72. package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
  73. package/lib/typescript/src/LocaleDirContext.d.ts +4 -0
  74. package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -0
  75. package/lib/typescript/src/NavigationContainer.d.ts +36 -13
  76. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  77. package/lib/typescript/src/ServerContainer.d.ts +2 -3
  78. package/lib/typescript/src/ServerContainer.d.ts.map +1 -1
  79. package/lib/typescript/src/ServerContext.d.ts +1 -2
  80. package/lib/typescript/src/ServerContext.d.ts.map +1 -1
  81. package/lib/typescript/src/UnhandledLinkingContext.d.ts +6 -0
  82. package/lib/typescript/src/UnhandledLinkingContext.d.ts.map +1 -0
  83. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +13 -0
  84. package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -0
  85. package/lib/typescript/src/{__mocks__ → __stubs__}/window.d.ts +5 -6
  86. package/lib/typescript/src/__stubs__/window.d.ts.map +1 -0
  87. package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
  88. package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -1
  89. package/lib/typescript/src/createStaticNavigation.d.ts +34 -0
  90. package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -0
  91. package/lib/typescript/src/extractPathFromURL.d.ts +1 -1
  92. package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
  93. package/lib/typescript/src/index.d.ts +15 -12
  94. package/lib/typescript/src/index.d.ts.map +1 -1
  95. package/lib/typescript/src/theming/DarkTheme.d.ts +1 -2
  96. package/lib/typescript/src/theming/DarkTheme.d.ts.map +1 -1
  97. package/lib/typescript/src/theming/DefaultTheme.d.ts +1 -2
  98. package/lib/typescript/src/theming/DefaultTheme.d.ts.map +1 -1
  99. package/lib/typescript/src/theming/fonts.d.ts +53 -0
  100. package/lib/typescript/src/theming/fonts.d.ts.map +1 -0
  101. package/lib/typescript/src/types.d.ts +35 -3
  102. package/lib/typescript/src/types.d.ts.map +1 -1
  103. package/lib/typescript/src/useBackButton.d.ts +1 -2
  104. package/lib/typescript/src/useBackButton.d.ts.map +1 -1
  105. package/lib/typescript/src/useBackButton.native.d.ts +1 -1
  106. package/lib/typescript/src/useBackButton.native.d.ts.map +1 -1
  107. package/lib/typescript/src/useDocumentTitle.d.ts +1 -1
  108. package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
  109. package/lib/typescript/src/useDocumentTitle.native.d.ts +1 -1
  110. package/lib/typescript/src/useDocumentTitle.native.d.ts.map +1 -1
  111. package/lib/typescript/src/useLinkBuilder.d.ts +97 -3
  112. package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
  113. package/lib/typescript/src/useLinkProps.d.ts +23 -10
  114. package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
  115. package/lib/typescript/src/useLinkTo.d.ts +6 -8
  116. package/lib/typescript/src/useLinkTo.d.ts.map +1 -1
  117. package/lib/typescript/src/useLinking.d.ts +5 -46
  118. package/lib/typescript/src/useLinking.d.ts.map +1 -1
  119. package/lib/typescript/src/useLinking.native.d.ts +11 -29
  120. package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
  121. package/lib/typescript/src/useLocale.d.ts +7 -0
  122. package/lib/typescript/src/useLocale.d.ts.map +1 -0
  123. package/lib/typescript/src/useRoutePath.d.ts +7 -0
  124. package/lib/typescript/src/useRoutePath.d.ts.map +1 -0
  125. package/lib/typescript/src/useScrollToTop.d.ts +2 -2
  126. package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
  127. package/lib/typescript/src/useThenable.d.ts +1 -1
  128. package/lib/typescript/src/useThenable.d.ts.map +1 -1
  129. package/oss-attribution/attribution.txt +50 -0
  130. package/oss-attribution/licenseInfos.json +18 -0
  131. package/package.json +97 -1
  132. package/src/Link.tsx +36 -20
  133. package/src/LinkingContext.tsx +9 -5
  134. package/src/LocaleDirContext.tsx +7 -0
  135. package/src/NavigationContainer.tsx +128 -69
  136. package/src/ServerContainer.tsx +4 -3
  137. package/src/ServerContext.tsx +1 -3
  138. package/src/UnhandledLinkingContext.tsx +18 -0
  139. package/src/__stubs__/createStackNavigator.tsx +46 -0
  140. package/src/{__mocks__ → __stubs__}/window.tsx +8 -8
  141. package/src/createMemoryHistory.tsx +16 -11
  142. package/src/createStaticNavigation.tsx +109 -0
  143. package/src/extractPathFromURL.tsx +3 -3
  144. package/src/index.tsx +15 -12
  145. package/src/theming/DarkTheme.tsx +3 -3
  146. package/src/theming/DefaultTheme.tsx +3 -3
  147. package/src/theming/fonts.tsx +63 -0
  148. package/src/types.tsx +49 -3
  149. package/src/useBackButton.native.tsx +2 -2
  150. package/src/useBackButton.tsx +2 -2
  151. package/src/useDocumentTitle.native.tsx +2 -2
  152. package/src/useDocumentTitle.tsx +2 -2
  153. package/src/useLinkBuilder.tsx +100 -55
  154. package/src/useLinkProps.tsx +80 -50
  155. package/src/useLinkTo.tsx +13 -53
  156. package/src/useLinking.native.tsx +33 -31
  157. package/src/useLinking.tsx +70 -23
  158. package/src/useLocale.tsx +18 -0
  159. package/src/useRoutePath.tsx +34 -0
  160. package/src/useScrollToTop.tsx +16 -12
  161. package/src/useThenable.tsx +2 -1
  162. package/SystemBundles/41869b563992545ca95a9a2f729e958cbdcada7391919e8e02112d791754072a.bundle +0 -14508
  163. package/SystemBundles/41869b563992545ca95a9a2f729e958cbdcada7391919e8e02112d791754072a.map +0 -5157
  164. package/SystemModules/amzn__react-navigation__native-7.modules.txt +0 -76
  165. package/SystemModules/amzn__react-navigation__native-7.private.modules.txt +0 -100
  166. package/THIRD_PARTY_NOTICES.txt +0 -24
  167. package/lib/commonjs/Link.js +0 -50
  168. package/lib/commonjs/Link.js.map +0 -1
  169. package/lib/commonjs/LinkingContext.js +0 -15
  170. package/lib/commonjs/LinkingContext.js.map +0 -1
  171. package/lib/commonjs/NavigationContainer.js +0 -109
  172. package/lib/commonjs/NavigationContainer.js.map +0 -1
  173. package/lib/commonjs/ServerContainer.js +0 -54
  174. package/lib/commonjs/ServerContainer.js.map +0 -1
  175. package/lib/commonjs/ServerContext.js +0 -12
  176. package/lib/commonjs/ServerContext.js.map +0 -1
  177. package/lib/commonjs/createMemoryHistory.js +0 -220
  178. package/lib/commonjs/createMemoryHistory.js.map +0 -1
  179. package/lib/commonjs/extractPathFromURL.js +0 -25
  180. package/lib/commonjs/extractPathFromURL.js.map +0 -1
  181. package/lib/commonjs/index.js +0 -129
  182. package/lib/commonjs/index.js.map +0 -1
  183. package/lib/commonjs/theming/DarkTheme.js +0 -19
  184. package/lib/commonjs/theming/DarkTheme.js.map +0 -1
  185. package/lib/commonjs/theming/DefaultTheme.js +0 -19
  186. package/lib/commonjs/theming/DefaultTheme.js.map +0 -1
  187. package/lib/commonjs/theming/ThemeContext.js +0 -15
  188. package/lib/commonjs/theming/ThemeContext.js.map +0 -1
  189. package/lib/commonjs/theming/ThemeProvider.js +0 -20
  190. package/lib/commonjs/theming/ThemeProvider.js.map +0 -1
  191. package/lib/commonjs/theming/useTheme.js +0 -16
  192. package/lib/commonjs/theming/useTheme.js.map +0 -1
  193. package/lib/commonjs/types.js +0 -6
  194. package/lib/commonjs/types.js.map +0 -1
  195. package/lib/commonjs/useBackButton.js +0 -11
  196. package/lib/commonjs/useBackButton.js.map +0 -1
  197. package/lib/commonjs/useBackButton.native.js +0 -27
  198. package/lib/commonjs/useBackButton.native.js.map +0 -1
  199. package/lib/commonjs/useDocumentTitle.js +0 -32
  200. package/lib/commonjs/useDocumentTitle.js.map +0 -1
  201. package/lib/commonjs/useDocumentTitle.native.js +0 -10
  202. package/lib/commonjs/useDocumentTitle.native.js.map +0 -1
  203. package/lib/commonjs/useLinkBuilder.js +0 -63
  204. package/lib/commonjs/useLinkBuilder.js.map +0 -1
  205. package/lib/commonjs/useLinkProps.js +0 -97
  206. package/lib/commonjs/useLinkProps.js.map +0 -1
  207. package/lib/commonjs/useLinkTo.js +0 -45
  208. package/lib/commonjs/useLinkTo.js.map +0 -1
  209. package/lib/commonjs/useLinking.js +0 -303
  210. package/lib/commonjs/useLinking.js.map +0 -1
  211. package/lib/commonjs/useLinking.native.js +0 -152
  212. package/lib/commonjs/useLinking.native.js.map +0 -1
  213. package/lib/commonjs/useScrollToTop.js +0 -95
  214. package/lib/commonjs/useScrollToTop.js.map +0 -1
  215. package/lib/commonjs/useThenable.js +0 -41
  216. package/lib/commonjs/useThenable.js.map +0 -1
  217. package/lib/module/theming/ThemeContext.js +0 -6
  218. package/lib/module/theming/ThemeContext.js.map +0 -1
  219. package/lib/module/theming/ThemeProvider.js +0 -11
  220. package/lib/module/theming/ThemeProvider.js.map +0 -1
  221. package/lib/module/theming/useTheme.js +0 -7
  222. package/lib/module/theming/useTheme.js.map +0 -1
  223. package/lib/typescript/src/__mocks__/window.d.ts.map +0 -1
  224. package/lib/typescript/src/theming/ThemeContext.d.ts +0 -5
  225. package/lib/typescript/src/theming/ThemeContext.d.ts.map +0 -1
  226. package/lib/typescript/src/theming/ThemeProvider.d.ts +0 -9
  227. package/lib/typescript/src/theming/ThemeProvider.d.ts.map +0 -1
  228. package/lib/typescript/src/theming/useTheme.d.ts +0 -2
  229. package/lib/typescript/src/theming/useTheme.d.ts.map +0 -1
  230. package/src/theming/ThemeContext.tsx +0 -10
  231. package/src/theming/ThemeProvider.tsx +0 -15
  232. package/src/theming/useTheme.tsx +0 -9
@@ -1,152 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = useLinking;
7
- var _reactNavigation__core = require("@amazon-devices/react-navigation__core");
8
- var React = _interopRequireWildcard(require("react"));
9
- var _reactNative = require("react-native");
10
- var _extractPathFromURL = _interopRequireDefault(require("./extractPathFromURL"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
- let linkingHandlers = [];
15
- function useLinking(ref, {
16
- independent,
17
- enabled = true,
18
- prefixes,
19
- filter,
20
- config,
21
- getInitialURL = () => Promise.race([_reactNative.Linking.getInitialURL(), new Promise(resolve =>
22
- // Timeout in 150ms if `getInitialState` doesn't resolve
23
- // Workaround for https://github.com/facebook/react-native/issues/25675
24
- setTimeout(resolve, 150))]),
25
- subscribe = listener => {
26
- var _Linking$removeEventL;
27
- const callback = ({
28
- url
29
- }) => listener(url);
30
- const subscription = _reactNative.Linking.addEventListener('url', callback);
31
-
32
- // Storing this in a local variable stops Jest from complaining about import after teardown
33
- // @ts-expect-error: removeEventListener is not present in newer RN versions
34
- const removeEventListener = (_Linking$removeEventL = _reactNative.Linking.removeEventListener) === null || _Linking$removeEventL === void 0 ? void 0 : _Linking$removeEventL.bind(_reactNative.Linking);
35
- return () => {
36
- // https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7
37
- if (subscription !== null && subscription !== void 0 && subscription.remove) {
38
- subscription.remove();
39
- } else {
40
- removeEventListener === null || removeEventListener === void 0 || removeEventListener('url', callback);
41
- }
42
- };
43
- },
44
- getStateFromPath = _reactNavigation__core.getStateFromPath,
45
- getActionFromState = _reactNavigation__core.getActionFromState
46
- }) {
47
- React.useEffect(() => {
48
- if (process.env.NODE_ENV === 'production') {
49
- return undefined;
50
- }
51
- if (independent) {
52
- return undefined;
53
- }
54
- if (enabled !== false && linkingHandlers.length) {
55
- console.error(['Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:', "- You don't have multiple NavigationContainers in the app each with 'linking' enabled", '- Only a single instance of the root component is rendered', _reactNative.Platform.OS === 'android' ? "- You have set 'android:launchMode=singleTask' in the '<activity />' section of the 'AndroidManifest.xml' file to avoid launching multiple instances" : ''].join('\n').trim());
56
- }
57
- const handler = Symbol();
58
- if (enabled !== false) {
59
- linkingHandlers.push(handler);
60
- }
61
- return () => {
62
- const index = linkingHandlers.indexOf(handler);
63
- if (index > -1) {
64
- linkingHandlers.splice(index, 1);
65
- }
66
- };
67
- }, [enabled, independent]);
68
-
69
- // We store these options in ref to avoid re-creating getInitialState and re-subscribing listeners
70
- // This lets user avoid wrapping the items in `React.useCallback` or `React.useMemo`
71
- // Not re-creating `getInitialState` is important coz it makes it easier for the user to use in an effect
72
- const enabledRef = React.useRef(enabled);
73
- const prefixesRef = React.useRef(prefixes);
74
- const filterRef = React.useRef(filter);
75
- const configRef = React.useRef(config);
76
- const getInitialURLRef = React.useRef(getInitialURL);
77
- const getStateFromPathRef = React.useRef(getStateFromPath);
78
- const getActionFromStateRef = React.useRef(getActionFromState);
79
- React.useEffect(() => {
80
- enabledRef.current = enabled;
81
- prefixesRef.current = prefixes;
82
- filterRef.current = filter;
83
- configRef.current = config;
84
- getInitialURLRef.current = getInitialURL;
85
- getStateFromPathRef.current = getStateFromPath;
86
- getActionFromStateRef.current = getActionFromState;
87
- });
88
- const getStateFromURL = React.useCallback(url => {
89
- if (!url || filterRef.current && !filterRef.current(url)) {
90
- return undefined;
91
- }
92
- const path = (0, _extractPathFromURL.default)(prefixesRef.current, url);
93
- return path !== undefined ? getStateFromPathRef.current(path, configRef.current) : undefined;
94
- }, []);
95
- const getInitialState = React.useCallback(() => {
96
- let state;
97
- if (enabledRef.current) {
98
- const url = getInitialURLRef.current();
99
- if (url != null && typeof url !== 'string') {
100
- return url.then(url => {
101
- const state = getStateFromURL(url);
102
- return state;
103
- });
104
- }
105
- state = getStateFromURL(url);
106
- }
107
- const thenable = {
108
- then(onfulfilled) {
109
- return Promise.resolve(onfulfilled ? onfulfilled(state) : state);
110
- },
111
- catch() {
112
- return thenable;
113
- }
114
- };
115
- return thenable;
116
- }, [getStateFromURL]);
117
- React.useEffect(() => {
118
- const listener = url => {
119
- if (!enabled) {
120
- return;
121
- }
122
- const navigation = ref.current;
123
- const state = navigation ? getStateFromURL(url) : undefined;
124
- if (navigation && state) {
125
- // Make sure that the routes in the state exist in the root navigator
126
- // Otherwise there's an error in the linking configuration
127
- const rootState = navigation.getRootState();
128
- if (state.routes.some(r => !(rootState !== null && rootState !== void 0 && rootState.routeNames.includes(r.name)))) {
129
- console.warn("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.");
130
- return;
131
- }
132
- const action = getActionFromStateRef.current(state, configRef.current);
133
- if (action !== undefined) {
134
- try {
135
- navigation.dispatch(action);
136
- } catch (e) {
137
- // Ignore any errors from deep linking.
138
- // This could happen in case of malformed links, navigation object not being initialized etc.
139
- console.warn(`An error occurred when trying to handle the link '${url}': ${typeof e === 'object' && e != null && 'message' in e ? e.message : e}`);
140
- }
141
- } else {
142
- navigation.resetRoot(state);
143
- }
144
- }
145
- };
146
- return subscribe(listener);
147
- }, [enabled, getStateFromURL, ref, subscribe]);
148
- return {
149
- getInitialState
150
- };
151
- }
152
- //# sourceMappingURL=useLinking.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNavigation__core","require","React","_interopRequireWildcard","_reactNative","_extractPathFromURL","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","linkingHandlers","useLinking","ref","independent","enabled","prefixes","filter","config","getInitialURL","Promise","race","Linking","resolve","setTimeout","subscribe","listener","_Linking$removeEventL","callback","url","subscription","addEventListener","removeEventListener","bind","remove","getStateFromPath","getStateFromPathDefault","getActionFromState","getActionFromStateDefault","useEffect","process","env","NODE_ENV","undefined","length","console","error","Platform","OS","join","trim","handler","Symbol","push","index","indexOf","splice","enabledRef","useRef","prefixesRef","filterRef","configRef","getInitialURLRef","getStateFromPathRef","getActionFromStateRef","current","getStateFromURL","useCallback","path","extractPathFromURL","getInitialState","state","then","thenable","onfulfilled","catch","navigation","rootState","getRootState","routes","some","routeNames","includes","name","warn","action","dispatch","message","resetRoot"],"sourceRoot":"../../src","sources":["useLinking.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEA,IAAAI,mBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAsD,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,OAAAC,cAAA,CAAAC,I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CAAC;UACD;QACF;QAEA,MAAMC,MAAM,GAAGrB,qBAAqB,CAACC,OAAO,CAACM,KAAK,EAAEV,SAAS,CAACI,OAAO,CAAC;QAEtE,IAAIoB,MAAM,KAAK1C,SAAS,EAAE;UACxB,IAAI;YACFiC,UAAU,CAACU,QAAQ,CAACD,MAAM,CAAC;UAC7B,CAAC,CAAC,OAAO9F,CAAC,EAAE;YACV;YACA;YACAsD,OAAO,CAACuC,IAAI,CACV,qDAAqDvD,GAAG,MACtD,OAAOtC,CAAC,KAAK,QAAQ,IAAIA,CAAC,IAAI,IAAI,IAAI,SAAS,IAAIA,CAAC,GAChDA,CAAC,CAACgG,OAAO,GACThG,CAAC,EAET,CAAC;UACH;QACF,CAAC,MAAM;UACLqF,UAAU,CAACY,SAAS,CAACjB,KAAK,CAAC;QAC7B;MACF;IACF,CAAC;IAED,OAAO9C,SAAS,CAACC,QAAQ,CAAC;EAC5B,CAAC,EAAE,CAACX,OAAO,EAAEmD,eAAe,EAAErD,GAAG,EAAEY,SAAS,CAAC,CAAC;EAE9C,OAAO;IACL6C;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,95 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = useScrollToTop;
7
- var _reactNavigation__core = require("@amazon-devices/react-navigation__core");
8
- var React = _interopRequireWildcard(require("react"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- function getScrollableNode(ref) {
12
- if (ref.current == null) {
13
- return null;
14
- }
15
- if ('scrollToTop' in ref.current || 'scrollTo' in ref.current || 'scrollToOffset' in ref.current || 'scrollResponderScrollTo' in ref.current) {
16
- // This is already a scrollable node.
17
- return ref.current;
18
- } else if ('getScrollResponder' in ref.current) {
19
- // If the view is a wrapper like FlatList, SectionList etc.
20
- // We need to use `getScrollResponder` to get access to the scroll responder
21
- return ref.current.getScrollResponder();
22
- } else if ('getNode' in ref.current) {
23
- // When a `ScrollView` is wraped in `Animated.createAnimatedComponent`
24
- // we need to use `getNode` to get the ref to the actual scrollview.
25
- // Note that `getNode` is deprecated in newer versions of react-native
26
- // this is why we check if we already have a scrollable node above.
27
- return ref.current.getNode();
28
- } else {
29
- return ref.current;
30
- }
31
- }
32
- function useScrollToTop(ref) {
33
- const navigation = (0, _reactNavigation__core.useNavigation)();
34
- const route = (0, _reactNavigation__core.useRoute)();
35
- React.useEffect(() => {
36
- let tabNavigations = [];
37
- let currentNavigation = navigation;
38
-
39
- // If the screen is nested inside multiple tab navigators, we should scroll to top for any of them
40
- // So we need to find all the parent tab navigators and add the listeners there
41
- while (currentNavigation) {
42
- if (currentNavigation.getState().type === 'tab') {
43
- tabNavigations.push(currentNavigation);
44
- }
45
- currentNavigation = currentNavigation.getParent();
46
- }
47
- if (tabNavigations.length === 0) {
48
- return;
49
- }
50
- const unsubscribers = tabNavigations.map(tab => {
51
- return tab.addListener(
52
- // We don't wanna import tab types here to avoid extra deps
53
- // in addition, there are multiple tab implementations
54
- // @ts-expect-error
55
- 'tabPress', e => {
56
- // We should scroll to top only when the screen is focused
57
- const isFocused = navigation.isFocused();
58
-
59
- // In a nested stack navigator, tab press resets the stack to first screen
60
- // So we should scroll to top only when we are on first screen
61
- const isFirst = tabNavigations.includes(navigation) || navigation.getState().routes[0].key === route.key;
62
-
63
- // Run the operation in the next frame so we're sure all listeners have been run
64
- // This is necessary to know if preventDefault() has been called
65
- requestAnimationFrame(() => {
66
- const scrollable = getScrollableNode(ref);
67
- if (isFocused && isFirst && scrollable && !e.defaultPrevented) {
68
- if ('scrollToTop' in scrollable) {
69
- scrollable.scrollToTop();
70
- } else if ('scrollTo' in scrollable) {
71
- scrollable.scrollTo({
72
- y: 0,
73
- animated: true
74
- });
75
- } else if ('scrollToOffset' in scrollable) {
76
- scrollable.scrollToOffset({
77
- offset: 0,
78
- animated: true
79
- });
80
- } else if ('scrollResponderScrollTo' in scrollable) {
81
- scrollable.scrollResponderScrollTo({
82
- y: 0,
83
- animated: true
84
- });
85
- }
86
- }
87
- });
88
- });
89
- });
90
- return () => {
91
- unsubscribers.forEach(unsubscribe => unsubscribe());
92
- };
93
- }, [navigation, ref, route.key]);
94
- }
95
- //# sourceMappingURL=useScrollToTop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNavigation__core","require","React","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","getScrollableNode","ref","current","getScrollResponder","getNode","useScrollToTop","navigation","useNavigation","route","useRoute","useEffect","tabNavigations","currentNavigation","getState","type","push","getParent","length","unsubscribers","map","tab","addListener","isFocused","isFirst","includes","routes","key","requestAnimationFrame","scrollable","defaultPrevented","scrollToTop","scrollTo","y","animated","scrollToOffset","offset","scrollResponderScrollTo","forEach","unsubscribe"],"sourceRoot":"../../src","sources":["useScrollToTop.tsx"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AAA+B,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,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,KAAK,CAACkB,GAAG;;QAEnD;QACA;QACAC,qBAAqB,CAAC,MAAM;UAC1B,MAAMC,UAAU,GAAG5B,iBAAiB,CAACC,GAAG,CAAsB;UAE9D,IAAIqB,SAAS,IAAIC,OAAO,IAAIK,UAAU,IAAI,CAAC/C,CAAC,CAACgD,gBAAgB,EAAE;YAC7D,IAAI,aAAa,IAAID,UAAU,EAAE;cAC/BA,UAAU,CAACE,WAAW,CAAC,CAAC;YAC1B,CAAC,MAAM,IAAI,UAAU,IAAIF,UAAU,EAAE;cACnCA,UAAU,CAACG,QAAQ,CAAC;gBAAEC,CAAC,EAAE,CAAC;gBAAEC,QAAQ,EAAE;cAAK,CAAC,CAAC;YAC/C,CAAC,MAAM,IAAI,gBAAgB,IAAIL,UAAU,EAAE;cACzCA,UAAU,CAACM,cAAc,CAAC;gBAAEC,MAAM,EAAE,CAAC;gBAAEF,QAAQ,EAAE;cAAK,CAAC,CAAC;YAC1D,CAAC,MAAM,IAAI,yBAAyB,IAAIL,UAAU,EAAE;cAClDA,UAAU,CAACQ,uBAAuB,CAAC;gBAAEJ,CAAC,EAAE,CAAC;gBAAEC,QAAQ,EAAE;cAAK,CAAC,CAAC;YAC9D;UACF;QACF,CAAC,CAAC;MACJ,CACF,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,MAAM;MACXf,aAAa,CAACmB,OAAO,CAAEC,WAAW,IAAKA,WAAW,CAAC,CAAC,CAAC;IACvD,CAAC;EACH,CAAC,EAAE,CAAChC,UAAU,EAAEL,GAAG,EAAEO,KAAK,CAACkB,GAAG,CAAC,CAAC;AAClC","ignoreList":[]}
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = useThenable;
7
- var React = _interopRequireWildcard(require("react"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
- function useThenable(create) {
11
- const [promise] = React.useState(create);
12
- let initialState = [false, undefined];
13
-
14
- // Check if our thenable is synchronous
15
- promise.then(result => {
16
- initialState = [true, result];
17
- });
18
- const [state, setState] = React.useState(initialState);
19
- const [resolved] = state;
20
- React.useEffect(() => {
21
- let cancelled = false;
22
- const resolve = async () => {
23
- let result;
24
- try {
25
- result = await promise;
26
- } finally {
27
- if (!cancelled) {
28
- setState([true, result]);
29
- }
30
- }
31
- };
32
- if (!resolved) {
33
- resolve();
34
- }
35
- return () => {
36
- cancelled = true;
37
- };
38
- }, [promise, resolved]);
39
- return state;
40
- }
41
- //# sourceMappingURL=useThenable.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useThenable","create","promise","useState","initialState","undefined","then","result","state","setState","resolved","useEffect","cancelled","resolve"],"sourceRoot":"../../src","sources":["useThenable.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAA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AAK,CAAC0B,QAAQ,CAACC,YAAY,CAAC;EACtD,MAAM,CAACM,QAAQ,CAAC,GAAGF,KAAK;EAExB/B,KAAK,CAACkC,SAAS,CAAC,MAAM;IACpB,IAAIC,SAAS,GAAG,KAAK;IAErB,MAAMC,OAAO,GAAG,MAAAA,CAAA,KAAY;MAC1B,IAAIN,MAAM;MAEV,IAAI;QACFA,MAAM,GAAG,MAAML,OAAO;MACxB,CAAC,SAAS;QACR,IAAI,CAACU,SAAS,EAAE;UACdH,QAAQ,CAAC,CAAC,IAAI,EAAEF,MAAM,CAAC,CAAC;QAC1B;MACF;IACF,CAAC;IAED,IAAI,CAACG,QAAQ,EAAE;MACbG,OAAO,CAAC,CAAC;IACX;IAEA,OAAO,MAAM;MACXD,SAAS,GAAG,IAAI;IAClB,CAAC;EACH,CAAC,EAAE,CAACV,OAAO,EAAEQ,QAAQ,CAAC,CAAC;EAEvB,OAAOF,KAAK;AACd","ignoreList":[]}
@@ -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":["theming/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","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import ThemeContext from './ThemeContext';
3
- export default function ThemeProvider({
4
- value,
5
- children
6
- }) {
7
- return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
8
- value: value
9
- }, children);
10
- }
11
- //# sourceMappingURL=ThemeProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","ThemeContext","ThemeProvider","value","children","createElement","Provider"],"sourceRoot":"../../../src","sources":["theming/ThemeProvider.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAG9B,OAAOC,YAAY,MAAM,gBAAgB;AAOzC,eAAe,SAASC,aAAaA,CAAC;EAAEC,KAAK;EAAEC;AAAgB,CAAC,EAAE;EAChE,oBACEJ,KAAA,CAAAK,aAAA,CAACJ,YAAY,CAACK,QAAQ;IAACH,KAAK,EAAEA;EAAM,GAAEC,QAAgC,CAAC;AAE3E","ignoreList":[]}
@@ -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":["theming/useTheme.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,eAAe,SAASC,QAAQA,CAAA,EAAG;EACjC,MAAMC,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACH,YAAY,CAAC;EAE5C,OAAOE,KAAK;AACd","ignoreList":[]}
@@ -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"}
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import type { Theme } from '../types';
4
- import DefaultTheme from './DefaultTheme';
5
-
6
- const ThemeContext = React.createContext<Theme>(DefaultTheme);
7
-
8
- ThemeContext.displayName = 'ThemeContext';
9
-
10
- export default ThemeContext;
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import type { Theme } from '../types';
4
- import ThemeContext from './ThemeContext';
5
-
6
- type Props = {
7
- value: Theme;
8
- children: React.ReactNode;
9
- };
10
-
11
- export default function ThemeProvider({ value, children }: Props) {
12
- return (
13
- <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
14
- );
15
- }
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import ThemeContext from './ThemeContext';
4
-
5
- export default function useTheme() {
6
- const theme = React.useContext(ThemeContext);
7
-
8
- return theme;
9
- }