@amazon-devices/react-navigation__stack 7.0.1759135970 → 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 (275) hide show
  1. package/SystemBundles/03e0ad8b8bcf16e659904adab730cbe9c1832c4a36017809f129fea7fb07b4fc.bundle +13453 -0
  2. package/SystemBundles/03e0ad8b8bcf16e659904adab730cbe9c1832c4a36017809f129fea7fb07b4fc.map +4627 -0
  3. package/SystemModules/amzn__react-navigation__stack-8.modules.txt +32 -0
  4. package/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +91 -0
  5. package/SystemModules/keplerscript-system-bundle-config.json +4 -4
  6. package/kepler-compatibility.json +2 -2
  7. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +57 -1
  8. package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  9. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +30 -16
  10. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  11. package/lib/module/TransitionConfigs/TransitionPresets.js +32 -4
  12. package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
  13. package/lib/module/TransitionConfigs/TransitionSpecs.js +32 -2
  14. package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
  15. package/lib/module/index.js +13 -11
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/navigators/createStackNavigator.js +46 -48
  18. package/lib/module/navigators/createStackNavigator.js.map +1 -1
  19. package/lib/module/package.json +1 -0
  20. package/lib/module/types.js +2 -0
  21. package/lib/module/types.js.map +1 -1
  22. package/lib/module/utils/CardAnimationContext.js +3 -1
  23. package/lib/module/utils/CardAnimationContext.js.map +1 -1
  24. package/lib/module/utils/GestureHandlerRefContext.js +3 -1
  25. package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
  26. package/lib/module/utils/ModalPresentationContext.js +3 -2
  27. package/lib/module/utils/ModalPresentationContext.js.map +1 -1
  28. package/lib/module/utils/conditional.js +3 -1
  29. package/lib/module/utils/conditional.js.map +1 -1
  30. package/lib/module/utils/findLastIndex.js +4 -2
  31. package/lib/module/utils/findLastIndex.js.map +1 -1
  32. package/lib/module/utils/gestureActivationCriteria.js +60 -0
  33. package/lib/module/utils/gestureActivationCriteria.js.map +1 -0
  34. package/lib/module/utils/getDistanceForDirection.js +5 -3
  35. package/lib/module/utils/getDistanceForDirection.js.map +1 -1
  36. package/lib/module/utils/getInvertedMultiplier.js +5 -4
  37. package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
  38. package/lib/module/utils/getModalRoutesKeys.js +12 -0
  39. package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
  40. package/lib/module/utils/getShadowStyle.js +24 -0
  41. package/lib/module/utils/getShadowStyle.js.map +1 -0
  42. package/lib/module/utils/{debounce.js → throttle.js} +5 -4
  43. package/lib/module/utils/throttle.js.map +1 -0
  44. package/lib/module/utils/useCardAnimation.js +4 -2
  45. package/lib/module/utils/useCardAnimation.js.map +1 -1
  46. package/lib/module/utils/useGestureHandlerRef.js +5 -3
  47. package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
  48. package/lib/module/utils/useKeyboardManager.js +8 -6
  49. package/lib/module/utils/useKeyboardManager.js.map +1 -1
  50. package/lib/module/views/GestureHandler.android.js +3 -1
  51. package/lib/module/views/GestureHandler.android.js.map +1 -1
  52. package/lib/module/views/GestureHandler.ios.js +3 -1
  53. package/lib/module/views/GestureHandler.ios.js.map +1 -1
  54. package/lib/module/views/GestureHandler.js +6 -1
  55. package/lib/module/views/GestureHandler.js.map +1 -1
  56. package/lib/module/views/GestureHandler.kepler.js +4 -0
  57. package/lib/module/views/GestureHandler.kepler.js.map +1 -0
  58. package/lib/module/views/GestureHandlerNative.js +13 -9
  59. package/lib/module/views/GestureHandlerNative.js.map +1 -1
  60. package/lib/module/views/Header/Header.js +12 -8
  61. package/lib/module/views/Header/Header.js.map +1 -1
  62. package/lib/module/views/Header/HeaderContainer.js +103 -93
  63. package/lib/module/views/Header/HeaderContainer.js.map +1 -1
  64. package/lib/module/views/Header/HeaderSegment.js +43 -31
  65. package/lib/module/views/Header/HeaderSegment.js.map +1 -1
  66. package/lib/module/views/Screens.js +17 -9
  67. package/lib/module/views/Screens.js.map +1 -1
  68. package/lib/module/views/Stack/Card.js +313 -338
  69. package/lib/module/views/Stack/Card.js.map +1 -1
  70. package/lib/module/views/Stack/CardA11yWrapper.js +43 -0
  71. package/lib/module/views/Stack/CardA11yWrapper.js.map +1 -0
  72. package/lib/module/views/Stack/CardContainer.js +116 -90
  73. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  74. package/lib/module/views/Stack/CardContent.js +74 -0
  75. package/lib/module/views/Stack/CardContent.js.map +1 -0
  76. package/lib/module/views/Stack/CardStack.js +246 -180
  77. package/lib/module/views/Stack/CardStack.js.map +1 -1
  78. package/lib/module/views/Stack/StackView.js +80 -64
  79. package/lib/module/views/Stack/StackView.js.map +1 -1
  80. package/lib/typescript/package.json +1 -0
  81. package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts +8 -0
  82. package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -1
  83. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts +3 -3
  84. package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
  85. package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +8 -0
  86. package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
  87. package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +10 -0
  88. package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -1
  89. package/lib/typescript/src/index.d.ts +8 -8
  90. package/lib/typescript/src/index.d.ts.map +1 -1
  91. package/lib/typescript/src/navigators/createStackNavigator.d.ts +15 -7
  92. package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
  93. package/lib/typescript/src/types.d.ts +84 -24
  94. package/lib/typescript/src/types.d.ts.map +1 -1
  95. package/lib/typescript/src/utils/CardAnimationContext.d.ts +1 -2
  96. package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +1 -1
  97. package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts +1 -2
  98. package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +1 -1
  99. package/lib/typescript/src/utils/ModalPresentationContext.d.ts +1 -2
  100. package/lib/typescript/src/utils/ModalPresentationContext.d.ts.map +1 -1
  101. package/lib/typescript/src/utils/conditional.d.ts +1 -1
  102. package/lib/typescript/src/utils/conditional.d.ts.map +1 -1
  103. package/lib/typescript/src/utils/findLastIndex.d.ts +1 -1
  104. package/lib/typescript/src/utils/findLastIndex.d.ts.map +1 -1
  105. package/lib/typescript/src/utils/gestureActivationCriteria.d.ts +57 -0
  106. package/lib/typescript/src/utils/gestureActivationCriteria.d.ts.map +1 -0
  107. package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
  108. package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
  109. package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
  110. package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
  111. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
  112. package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
  113. package/lib/typescript/src/utils/getShadowStyle.d.ts +27 -0
  114. package/lib/typescript/src/utils/getShadowStyle.d.ts.map +1 -0
  115. package/lib/typescript/src/utils/throttle.d.ts +2 -0
  116. package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
  117. package/lib/typescript/src/utils/useCardAnimation.d.ts +1 -1
  118. package/lib/typescript/src/utils/useCardAnimation.d.ts.map +1 -1
  119. package/lib/typescript/src/utils/useGestureHandlerRef.d.ts +1 -1
  120. package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +1 -1
  121. package/lib/typescript/src/utils/useKeyboardManager.d.ts +1 -1
  122. package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +1 -1
  123. package/lib/typescript/src/views/GestureHandler.d.ts +3 -2
  124. package/lib/typescript/src/views/GestureHandler.d.ts.map +1 -1
  125. package/lib/typescript/src/views/GestureHandler.kepler.d.ts +2 -0
  126. package/lib/typescript/src/views/GestureHandler.kepler.d.ts.map +1 -0
  127. package/lib/typescript/src/views/GestureHandlerNative.d.ts +4 -5
  128. package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
  129. package/lib/typescript/src/views/Header/Header.d.ts +1 -2
  130. package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
  131. package/lib/typescript/src/views/Header/HeaderContainer.d.ts +4 -5
  132. package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
  133. package/lib/typescript/src/views/Header/HeaderSegment.d.ts +2 -2
  134. package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
  135. package/lib/typescript/src/views/Screens.d.ts +7 -5
  136. package/lib/typescript/src/views/Screens.d.ts.map +1 -1
  137. package/lib/typescript/src/views/Stack/Card.d.ts +14 -42
  138. package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
  139. package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts +15 -0
  140. package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts.map +1 -0
  141. package/lib/typescript/src/views/Stack/CardContainer.d.ts +6 -8
  142. package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
  143. package/lib/typescript/src/views/Stack/CardContent.d.ts +13 -0
  144. package/lib/typescript/src/views/Stack/CardContent.d.ts.map +1 -0
  145. package/lib/typescript/src/views/Stack/CardStack.d.ts +8 -7
  146. package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
  147. package/lib/typescript/src/views/Stack/StackView.d.ts +10 -81
  148. package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
  149. package/oss-attribution/attribution.txt +76 -0
  150. package/oss-attribution/licenseInfos.json +27 -0
  151. package/package.json +105 -1
  152. package/src/TransitionConfigs/CardStyleInterpolators.tsx +72 -6
  153. package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +43 -25
  154. package/src/TransitionConfigs/TransitionPresets.tsx +35 -5
  155. package/src/TransitionConfigs/TransitionSpecs.tsx +30 -2
  156. package/src/index.tsx +12 -7
  157. package/src/navigators/createStackNavigator.tsx +47 -63
  158. package/src/types.tsx +116 -24
  159. package/src/utils/CardAnimationContext.tsx +3 -3
  160. package/src/utils/GestureHandlerRefContext.tsx +2 -2
  161. package/src/utils/ModalPresentationContext.tsx +1 -3
  162. package/src/utils/conditional.tsx +1 -1
  163. package/src/utils/findLastIndex.tsx +2 -5
  164. package/src/utils/gestureActivationCriteria.tsx +70 -0
  165. package/src/utils/getDistanceForDirection.tsx +5 -4
  166. package/src/utils/getInvertedMultiplier.tsx +5 -6
  167. package/src/utils/getModalRoutesKeys.ts +21 -0
  168. package/src/utils/getShadowStyle.tsx +37 -0
  169. package/src/utils/throttle.tsx +16 -0
  170. package/src/utils/useCardAnimation.tsx +2 -2
  171. package/src/utils/useGestureHandlerRef.tsx +3 -3
  172. package/src/utils/useKeyboardManager.tsx +5 -7
  173. package/src/views/GestureHandler.kepler.tsx +1 -0
  174. package/src/views/GestureHandler.tsx +2 -2
  175. package/src/views/GestureHandlerNative.tsx +5 -5
  176. package/src/views/Header/Header.tsx +8 -7
  177. package/src/views/Header/HeaderContainer.tsx +23 -18
  178. package/src/views/Header/HeaderSegment.tsx +41 -43
  179. package/src/views/Screens.tsx +4 -2
  180. package/src/views/Stack/Card.tsx +480 -462
  181. package/src/views/Stack/CardA11yWrapper.tsx +67 -0
  182. package/src/views/Stack/CardContainer.tsx +127 -108
  183. package/src/views/Stack/CardContent.tsx +92 -0
  184. package/src/views/Stack/CardStack.tsx +375 -243
  185. package/src/views/Stack/StackView.tsx +73 -62
  186. package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.bundle +0 -28538
  187. package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.map +0 -1
  188. package/SystemModules/amzn__react-navigation__stack-7.modules.txt +0 -95
  189. package/SystemModules/amzn__react-navigation__stack-7.private.modules.txt +0 -185
  190. package/THIRD_PARTY_NOTICES.txt +0 -24
  191. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +0 -353
  192. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +0 -1
  193. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +0 -259
  194. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +0 -1
  195. package/lib/commonjs/TransitionConfigs/TransitionPresets.js +0 -134
  196. package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +0 -1
  197. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +0 -100
  198. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +0 -1
  199. package/lib/commonjs/index.js +0 -69
  200. package/lib/commonjs/index.js.map +0 -1
  201. package/lib/commonjs/navigators/createStackNavigator.js +0 -82
  202. package/lib/commonjs/navigators/createStackNavigator.js.map +0 -1
  203. package/lib/commonjs/types.js +0 -6
  204. package/lib/commonjs/types.js.map +0 -1
  205. package/lib/commonjs/utils/CardAnimationContext.js +0 -11
  206. package/lib/commonjs/utils/CardAnimationContext.js.map +0 -1
  207. package/lib/commonjs/utils/GestureHandlerRefContext.js +0 -11
  208. package/lib/commonjs/utils/GestureHandlerRefContext.js.map +0 -1
  209. package/lib/commonjs/utils/ModalPresentationContext.js +0 -12
  210. package/lib/commonjs/utils/ModalPresentationContext.js.map +0 -1
  211. package/lib/commonjs/utils/conditional.js +0 -32
  212. package/lib/commonjs/utils/conditional.js.map +0 -1
  213. package/lib/commonjs/utils/debounce.js +0 -19
  214. package/lib/commonjs/utils/debounce.js.map +0 -1
  215. package/lib/commonjs/utils/findLastIndex.js +0 -15
  216. package/lib/commonjs/utils/findLastIndex.js.map +0 -1
  217. package/lib/commonjs/utils/getDistanceForDirection.js +0 -20
  218. package/lib/commonjs/utils/getDistanceForDirection.js.map +0 -1
  219. package/lib/commonjs/utils/getInvertedMultiplier.js +0 -20
  220. package/lib/commonjs/utils/getInvertedMultiplier.js.map +0 -1
  221. package/lib/commonjs/utils/memoize.js +0 -33
  222. package/lib/commonjs/utils/memoize.js.map +0 -1
  223. package/lib/commonjs/utils/useCardAnimation.js +0 -19
  224. package/lib/commonjs/utils/useCardAnimation.js.map +0 -1
  225. package/lib/commonjs/utils/useGestureHandlerRef.js +0 -19
  226. package/lib/commonjs/utils/useGestureHandlerRef.js.map +0 -1
  227. package/lib/commonjs/utils/useKeyboardManager.js +0 -96
  228. package/lib/commonjs/utils/useKeyboardManager.js.map +0 -1
  229. package/lib/commonjs/views/GestureHandler.android.js +0 -17
  230. package/lib/commonjs/views/GestureHandler.android.js.map +0 -1
  231. package/lib/commonjs/views/GestureHandler.ios.js +0 -17
  232. package/lib/commonjs/views/GestureHandler.ios.js.map +0 -1
  233. package/lib/commonjs/views/GestureHandler.js +0 -24
  234. package/lib/commonjs/views/GestureHandler.js.map +0 -1
  235. package/lib/commonjs/views/GestureHandlerNative.js +0 -34
  236. package/lib/commonjs/views/GestureHandlerNative.js.map +0 -1
  237. package/lib/commonjs/views/Header/Header.js +0 -61
  238. package/lib/commonjs/views/Header/Header.js.map +0 -1
  239. package/lib/commonjs/views/Header/HeaderContainer.js +0 -127
  240. package/lib/commonjs/views/Header/HeaderContainer.js.map +0 -1
  241. package/lib/commonjs/views/Header/HeaderSegment.js +0 -139
  242. package/lib/commonjs/views/Header/HeaderSegment.js.map +0 -1
  243. package/lib/commonjs/views/ModalStatusBarManager.js +0 -42
  244. package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
  245. package/lib/commonjs/views/Screens.js +0 -44
  246. package/lib/commonjs/views/Screens.js.map +0 -1
  247. package/lib/commonjs/views/Stack/Card.js +0 -469
  248. package/lib/commonjs/views/Stack/Card.js.map +0 -1
  249. package/lib/commonjs/views/Stack/CardContainer.js +0 -259
  250. package/lib/commonjs/views/Stack/CardContainer.js.map +0 -1
  251. package/lib/commonjs/views/Stack/CardSheet.js +0 -54
  252. package/lib/commonjs/views/Stack/CardSheet.js.map +0 -1
  253. package/lib/commonjs/views/Stack/CardStack.js +0 -442
  254. package/lib/commonjs/views/Stack/CardStack.js.map +0 -1
  255. package/lib/commonjs/views/Stack/StackView.js +0 -333
  256. package/lib/commonjs/views/Stack/StackView.js.map +0 -1
  257. package/lib/module/utils/debounce.js.map +0 -1
  258. package/lib/module/utils/memoize.js +0 -27
  259. package/lib/module/utils/memoize.js.map +0 -1
  260. package/lib/module/views/ModalStatusBarManager.js +0 -34
  261. package/lib/module/views/ModalStatusBarManager.js.map +0 -1
  262. package/lib/module/views/Stack/CardSheet.js +0 -46
  263. package/lib/module/views/Stack/CardSheet.js.map +0 -1
  264. package/lib/typescript/src/utils/debounce.d.ts +0 -2
  265. package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
  266. package/lib/typescript/src/utils/memoize.d.ts +0 -2
  267. package/lib/typescript/src/utils/memoize.d.ts.map +0 -1
  268. package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -12
  269. package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
  270. package/lib/typescript/src/views/Stack/CardSheet.d.ts +0 -15
  271. package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +0 -1
  272. package/src/utils/debounce.tsx +0 -17
  273. package/src/utils/memoize.tsx +0 -33
  274. package/src/views/ModalStatusBarManager.tsx +0 -50
  275. package/src/views/Stack/CardSheet.tsx +0 -61
@@ -1,16 +1,35 @@
1
- import { Background, getDefaultHeaderHeight, SafeAreaProviderCompat } from '@amazon-devices/react-navigation__elements';
2
- import Color from 'color';
1
+ "use strict";
2
+
3
+ import { getDefaultHeaderHeight, SafeAreaProviderCompat } from '@amazon-devices/react-navigation__elements';
3
4
  import * as React from 'react';
4
- import { Animated, Platform, StyleSheet } from 'react-native';
5
- import { forModalPresentationIOS, forNoAnimation as forNoAnimationCard } from '../../TransitionConfigs/CardStyleInterpolators';
6
- import { DefaultTransition, ModalFadeTransition, ModalTransition } from '../../TransitionConfigs/TransitionPresets';
7
- import findLastIndex from '../../utils/findLastIndex';
8
- import getDistanceForDirection from '../../utils/getDistanceForDirection';
9
- import { MaybeScreen, MaybeScreenContainer } from '../Screens';
10
- import { getIsModalPresentation } from './Card';
11
- import CardContainer from './CardContainer';
5
+ import { Animated, Platform, StyleSheet, View } from 'react-native';
6
+ import { forModalPresentationIOS, forNoAnimation as forNoAnimationCard } from "../../TransitionConfigs/CardStyleInterpolators.js";
7
+ import { BottomSheetAndroid, DefaultTransition, FadeFromBottomAndroid, FadeFromRightAndroid, ModalFadeTransition, ModalSlideFromBottomIOS, ModalTransition, RevealFromBottomAndroid, ScaleFromCenterAndroid, SlideFromLeftIOS, SlideFromRightIOS } from "../../TransitionConfigs/TransitionPresets.js";
8
+ import { findLastIndex } from "../../utils/findLastIndex.js";
9
+ import { getDistanceForDirection } from "../../utils/getDistanceForDirection.js";
10
+ import { getModalRouteKeys } from "../../utils/getModalRoutesKeys.js";
11
+ import { MaybeScreen, MaybeScreenContainer } from "../Screens.js";
12
+ import { CardContainer } from "./CardContainer.js";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const NAMED_TRANSITIONS_PRESETS = {
15
+ default: DefaultTransition,
16
+ fade: ModalFadeTransition,
17
+ fade_from_bottom: FadeFromBottomAndroid,
18
+ fade_from_right: FadeFromRightAndroid,
19
+ none: DefaultTransition,
20
+ reveal_from_bottom: RevealFromBottomAndroid,
21
+ scale_from_center: ScaleFromCenterAndroid,
22
+ slide_from_left: SlideFromLeftIOS,
23
+ slide_from_right: SlideFromRightIOS,
24
+ slide_from_bottom: Platform.select({
25
+ ios: ModalSlideFromBottomIOS,
26
+ default: BottomSheetAndroid
27
+ })
28
+ };
29
+ const EPSILON = 1e-5;
12
30
  const STATE_INACTIVE = 0;
13
31
  const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
32
+ const STATE_ON_TOP = 2;
14
33
  const FALLBACK_DESCRIPTOR = Object.freeze({
15
34
  options: {}
16
35
  });
@@ -22,8 +41,7 @@ const getInterpolationIndex = (scenes, index) => {
22
41
  // Start from current card and count backwards the number of cards with same interpolation
23
42
  let interpolationIndex = 0;
24
43
  for (let i = index - 1; i >= 0; i--) {
25
- var _scenes$i;
26
- const cardStyleInterpolatorCurrent = (_scenes$i = scenes[i]) === null || _scenes$i === void 0 ? void 0 : _scenes$i.descriptor.options.cardStyleInterpolator;
44
+ const cardStyleInterpolatorCurrent = scenes[i]?.descriptor.options.cardStyleInterpolator;
27
45
  if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {
28
46
  break;
29
47
  }
@@ -31,6 +49,11 @@ const getInterpolationIndex = (scenes, index) => {
31
49
  }
32
50
  return interpolationIndex;
33
51
  };
52
+ const getIsModalPresentation = cardStyleInterpolator => {
53
+ return cardStyleInterpolator === forModalPresentationIOS ||
54
+ // Handle custom modal presentation interpolators as well
55
+ cardStyleInterpolator.name === 'forModalPresentationIOS';
56
+ };
34
57
  const getIsModal = (scene, interpolationIndex, isParentModal) => {
35
58
  if (isParentModal) {
36
59
  return true;
@@ -56,20 +79,21 @@ const getHeaderHeights = (scenes, insets, isParentHeaderShown, isParentModal, la
56
79
  return acc;
57
80
  }, {});
58
81
  };
59
- const getDistanceFromOptions = (layout, descriptor) => {
60
- const {
61
- presentation,
62
- gestureDirection = presentation === 'modal' ? ModalTransition.gestureDirection : DefaultTransition.gestureDirection
63
- } = (descriptor === null || descriptor === void 0 ? void 0 : descriptor.options) || {};
64
- return getDistanceForDirection(layout, gestureDirection);
82
+ const getDistanceFromOptions = (layout, options, isRTL) => {
83
+ if (options?.gestureDirection) {
84
+ return getDistanceForDirection(layout, options.gestureDirection, isRTL);
85
+ }
86
+ const defaultGestureDirection = options?.presentation === 'modal' ? ModalTransition.gestureDirection : DefaultTransition.gestureDirection;
87
+ const gestureDirection = options?.animation ? NAMED_TRANSITIONS_PRESETS[options?.animation]?.gestureDirection : defaultGestureDirection;
88
+ return getDistanceForDirection(layout, gestureDirection, isRTL);
65
89
  };
66
- const getProgressFromGesture = (gesture, layout, descriptor) => {
90
+ const getProgressFromGesture = (gesture, layout, options, isRTL) => {
67
91
  const distance = getDistanceFromOptions({
68
92
  // Make sure that we have a non-zero distance, otherwise there will be incorrect progress
69
93
  // This causes blank screen on web if it was previously inside container with display: none
70
94
  width: Math.max(1, layout.width),
71
95
  height: Math.max(1, layout.height)
72
- }, descriptor);
96
+ }, options, isRTL);
73
97
  if (distance > 0) {
74
98
  return gesture.interpolate({
75
99
  inputRange: [0, distance],
@@ -81,55 +105,75 @@ const getProgressFromGesture = (gesture, layout, descriptor) => {
81
105
  outputRange: [0, 1]
82
106
  });
83
107
  };
84
- export default class CardStack extends React.Component {
108
+ function getDefaultAnimation(animation) {
109
+ // Disable screen transition animation by default on web, windows and macos to match the native behavior
110
+ const excludedPlatforms = Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos';
111
+ return animation ?? (excludedPlatforms ? 'default' : 'none');
112
+ }
113
+ export function getAnimationEnabled(animation) {
114
+ return getDefaultAnimation(animation) !== 'none';
115
+ }
116
+ export class CardStack extends React.Component {
85
117
  static getDerivedStateFromProps(props, state) {
86
118
  if (props.routes === state.routes && props.descriptors === state.descriptors) {
87
119
  return null;
88
120
  }
89
- const gestures = props.routes.reduce((acc, curr) => {
90
- const descriptor = props.descriptors[curr.key];
121
+ const gestures = [...props.routes, ...props.state.preloadedRoutes].reduce((acc, curr) => {
122
+ const descriptor = props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];
91
123
  const {
92
- animationEnabled
93
- } = (descriptor === null || descriptor === void 0 ? void 0 : descriptor.options) || {};
94
- acc[curr.key] = state.gestures[curr.key] || new Animated.Value(props.openingRouteKeys.includes(curr.key) && animationEnabled !== false ? getDistanceFromOptions(state.layout, descriptor) : 0);
124
+ animation
125
+ } = descriptor?.options || {};
126
+ acc[curr.key] = state.gestures[curr.key] || new Animated.Value(props.openingRouteKeys.includes(curr.key) && getAnimationEnabled(animation) || props.state.preloadedRoutes.includes(curr) ? getDistanceFromOptions(state.layout, descriptor?.options, props.direction === 'rtl') : 0);
95
127
  return acc;
96
128
  }, {});
97
- const scenes = props.routes.map((route, index, self) => {
98
- const previousRoute = self[index - 1];
99
- const nextRoute = self[index + 1];
129
+ const modalRouteKeys = getModalRouteKeys([...props.routes, ...props.state.preloadedRoutes], {
130
+ ...props.descriptors,
131
+ ...props.preloadedDescriptors
132
+ });
133
+ const scenes = [...props.routes, ...props.state.preloadedRoutes].map((route, index, self) => {
134
+ // For preloaded screens, we don't care about the previous and the next screen
135
+ const isPreloaded = props.state.preloadedRoutes.includes(route);
136
+ const previousRoute = isPreloaded ? undefined : self[index - 1];
137
+ const nextRoute = isPreloaded ? undefined : self[index + 1];
100
138
  const oldScene = state.scenes[index];
101
139
  const currentGesture = gestures[route.key];
102
140
  const previousGesture = previousRoute ? gestures[previousRoute.key] : undefined;
103
141
  const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;
104
- const descriptor = props.descriptors[route.key] || state.descriptors[route.key] || (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);
105
- const nextDescriptor = props.descriptors[nextRoute === null || nextRoute === void 0 ? void 0 : nextRoute.key] || state.descriptors[nextRoute === null || nextRoute === void 0 ? void 0 : nextRoute.key];
106
- const previousDescriptor = props.descriptors[previousRoute === null || previousRoute === void 0 ? void 0 : previousRoute.key] || state.descriptors[previousRoute === null || previousRoute === void 0 ? void 0 : previousRoute.key];
142
+ const descriptor = (isPreloaded ? props.preloadedDescriptors : props.descriptors)[route.key] || state.descriptors[route.key] || (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);
143
+ const nextOptions = nextRoute && (props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key])?.options;
144
+ const previousOptions = previousRoute && (props.descriptors[previousRoute?.key] || state.descriptors[previousRoute?.key])?.options;
107
145
 
108
146
  // When a screen is not the last, it should use next screen's transition config
109
147
  // Many transitions also animate the previous screen, so using 2 different transitions doesn't look right
110
148
  // For example combining a slide and a modal transition would look wrong otherwise
111
149
  // With this approach, combining different transition styles in the same navigator mostly looks right
112
150
  // This will still be broken when 2 transitions have different idle state (e.g. modal presentation),
113
- // but majority of the transitions look alright
114
- const optionsForTransitionConfig = index !== self.length - 1 && nextDescriptor && nextDescriptor.options.presentation !== 'transparentModal' ? nextDescriptor.options : descriptor.options;
115
- let defaultTransitionPreset = optionsForTransitionConfig.presentation === 'modal' ? ModalTransition : optionsForTransitionConfig.presentation === 'transparentModal' ? ModalFadeTransition : DefaultTransition;
151
+ // but the majority of the transitions look alright
152
+ const optionsForTransitionConfig = index !== self.length - 1 && nextOptions && nextOptions?.presentation !== 'transparentModal' ? nextOptions : descriptor.options;
153
+
154
+ // Assume modal if there are already modal screens in the stack
155
+ // or current screen is a modal when no presentation is specified
156
+ const isModal = modalRouteKeys.includes(route.key);
157
+ const animation = getDefaultAnimation(optionsForTransitionConfig.animation);
158
+ const isAnimationEnabled = getAnimationEnabled(animation);
159
+ const transitionPreset = animation !== 'default' ? NAMED_TRANSITIONS_PRESETS[animation] : optionsForTransitionConfig.presentation === 'transparentModal' ? ModalFadeTransition : optionsForTransitionConfig.presentation === 'modal' || isModal ? ModalTransition : DefaultTransition;
116
160
  const {
117
- animationEnabled = Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos',
118
- gestureEnabled = Platform.OS === 'ios' && animationEnabled,
119
- gestureDirection = defaultTransitionPreset.gestureDirection,
120
- transitionSpec = defaultTransitionPreset.transitionSpec,
121
- cardStyleInterpolator = animationEnabled === false ? forNoAnimationCard : defaultTransitionPreset.cardStyleInterpolator,
122
- headerStyleInterpolator = defaultTransitionPreset.headerStyleInterpolator,
161
+ gestureEnabled = Platform.OS === 'ios' && isAnimationEnabled,
162
+ gestureDirection = transitionPreset.gestureDirection,
163
+ transitionSpec = transitionPreset.transitionSpec,
164
+ cardStyleInterpolator = isAnimationEnabled ? transitionPreset.cardStyleInterpolator : forNoAnimationCard,
165
+ headerStyleInterpolator = transitionPreset.headerStyleInterpolator,
123
166
  cardOverlayEnabled = Platform.OS !== 'ios' && optionsForTransitionConfig.presentation !== 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)
124
167
  } = optionsForTransitionConfig;
125
- const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' || (nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation) === 'modal' || (nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation) === 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)) && Platform.OS === 'ios' && descriptor.options.header === undefined ? 'float' : 'screen');
168
+ const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' || nextOptions?.presentation === 'modal' || nextOptions?.presentation === 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)) && Platform.OS === 'ios' && descriptor.options.header === undefined ? 'float' : 'screen');
169
+ const isRTL = props.direction === 'rtl';
126
170
  const scene = {
127
171
  route,
128
172
  descriptor: {
129
173
  ...descriptor,
130
174
  options: {
131
175
  ...descriptor.options,
132
- animationEnabled,
176
+ animation,
133
177
  cardOverlayEnabled,
134
178
  cardStyleInterpolator,
135
179
  gestureDirection,
@@ -140,11 +184,11 @@ export default class CardStack extends React.Component {
140
184
  }
141
185
  },
142
186
  progress: {
143
- current: getProgressFromGesture(currentGesture, state.layout, descriptor),
144
- next: nextGesture && (nextDescriptor === null || nextDescriptor === void 0 ? void 0 : nextDescriptor.options.presentation) !== 'transparentModal' ? getProgressFromGesture(nextGesture, state.layout, nextDescriptor) : undefined,
145
- previous: previousGesture ? getProgressFromGesture(previousGesture, state.layout, previousDescriptor) : undefined
187
+ current: getProgressFromGesture(currentGesture, state.layout, descriptor.options, isRTL),
188
+ next: nextGesture && nextOptions?.presentation !== 'transparentModal' ? getProgressFromGesture(nextGesture, state.layout, nextOptions, isRTL) : undefined,
189
+ previous: previousGesture ? getProgressFromGesture(previousGesture, state.layout, previousOptions, isRTL) : undefined
146
190
  },
147
- __memo: [state.layout, descriptor, nextDescriptor, previousDescriptor, currentGesture, nextGesture, previousGesture]
191
+ __memo: [state.layout, descriptor, nextOptions, previousOptions, currentGesture, nextGesture, previousGesture]
148
192
  };
149
193
  if (oldScene && scene.__memo.every((it, i) => {
150
194
  // @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere
@@ -154,11 +198,70 @@ export default class CardStack extends React.Component {
154
198
  }
155
199
  return scene;
156
200
  });
201
+ let activeStates = state.activeStates;
202
+ if (props.routes.length !== state.routes.length) {
203
+ // amznmod_react - change activeScreensLimit from 1 to 2
204
+ // Increase activeScreensLimit to prevent detaching the screen underneath
205
+ // When performing a pop animation, the screen underneath is inactive and has to by mounted
206
+ // This takes a long time and results with a noticeable delay when navigating between screens
207
+ // @ts-ignore - accept kepler as a platform
208
+ let activeScreensLimit = Platform.OS === 'kepler' ? 2 : 1;
209
+ for (let i = props.routes.length - 1; i >= 0; i--) {
210
+ const {
211
+ options
212
+ } = scenes[i].descriptor;
213
+ const {
214
+ // By default, we don't want to detach the previous screen of the active one for modals
215
+ detachPreviousScreen = options.presentation === 'transparentModal' ? false : getIsModalPresentation(options.cardStyleInterpolator) ? i !== findLastIndex(scenes, scene => {
216
+ const {
217
+ cardStyleInterpolator
218
+ } = scene.descriptor.options;
219
+ return cardStyleInterpolator === forModalPresentationIOS || cardStyleInterpolator?.name === 'forModalPresentationIOS';
220
+ }) : true
221
+ } = options;
222
+ if (detachPreviousScreen === false) {
223
+ activeScreensLimit++;
224
+ } else {
225
+ // Check at least last 2 screens before stopping
226
+ // This will make sure that screen isn't detached when another screen is animating on top of the transparent one
227
+ // e.g. opaque -> transparent -> opaque
228
+ if (i <= props.routes.length - 2) {
229
+ break;
230
+ }
231
+ }
232
+ }
233
+ activeStates = props.routes.map((_, index, self) => {
234
+ // The activity state represents state of the screen:
235
+ // 0 - inactive, the screen is detached
236
+ // 1 - transitioning or below the top screen, the screen is mounted but interaction is disabled
237
+ // 2 - on top of the stack, the screen is mounted and interaction is enabled
238
+ let activityState;
239
+ const lastActiveState = state.activeStates[index];
240
+ const activeAfterTransition = index >= self.length - activeScreensLimit;
241
+ if (lastActiveState === STATE_INACTIVE && !activeAfterTransition) {
242
+ // screen was inactive before and it will still be inactive after the transition
243
+ activityState = STATE_INACTIVE;
244
+ } else {
245
+ const sceneForActivity = scenes[self.length - 1];
246
+ const outputValue = index === self.length - 1 ? STATE_ON_TOP // the screen is on top after the transition
247
+ : activeAfterTransition ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
248
+ : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
249
+
250
+ activityState = sceneForActivity ? sceneForActivity.progress.current.interpolate({
251
+ inputRange: [0, 1 - EPSILON, 1],
252
+ outputRange: [1, 1, outputValue],
253
+ extrapolate: 'clamp'
254
+ }) : STATE_TRANSITIONING_OR_BELOW_TOP;
255
+ }
256
+ return activityState;
257
+ });
258
+ }
157
259
  return {
158
260
  routes: props.routes,
159
261
  scenes,
160
262
  gestures,
161
263
  descriptors: props.descriptors,
264
+ activeStates,
162
265
  headerHeights: getHeaderHeights(scenes, props.insets, props.isParentHeaderShown, props.isParentModal, state.layout, state.headerHeights)
163
266
  };
164
267
  }
@@ -170,6 +273,7 @@ export default class CardStack extends React.Component {
170
273
  gestures: {},
171
274
  layout: SafeAreaProviderCompat.initialMetrics.frame,
172
275
  descriptors: this.props.descriptors,
276
+ activeStates: [],
173
277
  // Used when card's header is null and mode is float to make transition
174
278
  // between screens with headers and those without headers smooth.
175
279
  // This is not a great heuristic here. We don't know synchronously
@@ -245,11 +349,11 @@ export default class CardStack extends React.Component {
245
349
  insets,
246
350
  state,
247
351
  routes,
352
+ openingRouteKeys,
248
353
  closingRouteKeys,
249
354
  onOpenRoute,
250
355
  onCloseRoute,
251
356
  renderHeader,
252
- renderScene,
253
357
  isParentHeaderShown,
254
358
  isParentModal,
255
359
  onTransitionStart,
@@ -258,14 +362,14 @@ export default class CardStack extends React.Component {
258
362
  onGestureEnd,
259
363
  onGestureCancel,
260
364
  detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios' ||
261
- //amznmod_react add kepler platform
262
- //@ts-ignore
365
+ // @ts-ignore - accept kepler as a platform
263
366
  Platform.OS === 'kepler'
264
367
  } = this.props;
265
368
  const {
266
369
  scenes,
267
370
  layout,
268
371
  gestures,
372
+ activeStates,
269
373
  headerHeights
270
374
  } = this.state;
271
375
  const focusedRoute = state.routes[state.index];
@@ -282,137 +386,99 @@ export default class CardStack extends React.Component {
282
386
  }
283
387
  return false;
284
388
  });
285
- let activeScreensLimit = 1;
286
- for (let i = scenes.length - 1; i >= 0; i--) {
287
- const {
288
- options
289
- } = scenes[i].descriptor;
290
- const {
291
- // By default, we don't want to detach the previous screen of the active one for modals
292
- detachPreviousScreen = options.presentation === 'transparentModal' ? false : getIsModalPresentation(options.cardStyleInterpolator) ? i !== findLastIndex(scenes, scene => {
293
- const {
294
- cardStyleInterpolator
295
- } = scene.descriptor.options;
296
- return cardStyleInterpolator === forModalPresentationIOS || (cardStyleInterpolator === null || cardStyleInterpolator === void 0 ? void 0 : cardStyleInterpolator.name) === 'forModalPresentationIOS';
297
- }) : true
298
- } = options;
299
- if (detachPreviousScreen === false) {
300
- activeScreensLimit++;
301
- } else {
302
- // Check at least last 2 screens before stopping
303
- // This will make sure that screen isn't detached when another screen is animating on top of the transparent one
304
- // For example, (Opaque -> Transparent -> Opaque)
305
- if (i <= scenes.length - 2) {
306
- break;
307
- }
308
- }
309
- }
310
- const floatingHeader = /*#__PURE__*/React.createElement(React.Fragment, {
311
- key: "header"
312
- }, renderHeader({
313
- mode: 'float',
314
- layout,
315
- scenes,
316
- getPreviousScene: this.getPreviousScene,
317
- getFocusedRoute: this.getFocusedRoute,
318
- onContentHeightChange: this.handleHeaderLayout,
319
- style: [styles.floating, isFloatHeaderAbsolute && [
320
- // Without this, the header buttons won't be touchable on Android when headerTransparent: true
321
- {
322
- height: focusedHeaderHeight
323
- }, styles.absolute]]
324
- }));
325
- return /*#__PURE__*/React.createElement(Background, null, isFloatHeaderAbsolute ? null : floatingHeader, /*#__PURE__*/React.createElement(MaybeScreenContainer, {
326
- enabled: detachInactiveScreens,
389
+ return /*#__PURE__*/_jsxs(View, {
327
390
  style: styles.container,
328
- onLayout: this.handleLayout
329
- }, routes.map((route, index, self) => {
330
- var _scenes, _scenes2;
331
- const focused = focusedRoute.key === route.key;
332
- const gesture = gestures[route.key];
333
- const scene = scenes[index];
334
-
335
- // For the screens that shouldn't be active, the value is 0
336
- // For those that should be active, but are not the top screen, the value is 1
337
- // For those on top of the stack and with interaction enabled, the value is 2
338
- // For the old implementation, it stays the same it was
339
- let isScreenActive = 1;
340
- if (index < self.length - activeScreensLimit - 1) {
341
- // screen should be inactive because it is too deep in the stack
342
- isScreenActive = STATE_INACTIVE;
343
- } else {
344
- isScreenActive = STATE_TRANSITIONING_OR_BELOW_TOP;
345
- }
346
- const {
347
- headerShown = true,
348
- headerTransparent,
349
- headerStyle,
350
- headerTintColor,
351
- freezeOnBlur
352
- } = scene.descriptor.options;
353
- const safeAreaInsetTop = insets.top;
354
- const safeAreaInsetRight = insets.right;
355
- const safeAreaInsetBottom = insets.bottom;
356
- const safeAreaInsetLeft = insets.left;
357
- const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
358
- let headerDarkContent;
359
- if (headerShown) {
360
- if (typeof headerTintColor === 'string') {
361
- headerDarkContent = Color(headerTintColor).isDark();
362
- } else {
363
- const flattenedHeaderStyle = StyleSheet.flatten(headerStyle);
364
- if (flattenedHeaderStyle && 'backgroundColor' in flattenedHeaderStyle && typeof flattenedHeaderStyle.backgroundColor === 'string') {
365
- headerDarkContent = !Color(flattenedHeaderStyle.backgroundColor).isDark();
366
- }
367
- }
368
- }
369
-
370
- // Start from current card and count backwards the number of cards with same interpolation
371
- const interpolationIndex = getInterpolationIndex(scenes, index);
372
- const isModal = getIsModal(scene, interpolationIndex, isParentModal);
373
- const isNextScreenTransparent = ((_scenes = scenes[index + 1]) === null || _scenes === void 0 ? void 0 : _scenes.descriptor.options.presentation) === 'transparentModal';
374
- const detachCurrentScreen = ((_scenes2 = scenes[index + 1]) === null || _scenes2 === void 0 ? void 0 : _scenes2.descriptor.options.detachPreviousScreen) !== false;
375
- return /*#__PURE__*/React.createElement(MaybeScreen, {
376
- key: route.key,
377
- style: StyleSheet.absoluteFill,
378
- enabled: detachInactiveScreens,
379
- active: isScreenActive,
380
- freezeOnBlur: freezeOnBlur,
381
- pointerEvents: "box-none"
382
- }, /*#__PURE__*/React.createElement(CardContainer, {
383
- index: index,
384
- interpolationIndex: interpolationIndex,
385
- modal: isModal,
386
- active: index === self.length - 1,
387
- focused: focused,
388
- closing: closingRouteKeys.includes(route.key),
389
- layout: layout,
390
- gesture: gesture,
391
- scene: scene,
392
- safeAreaInsetTop: safeAreaInsetTop,
393
- safeAreaInsetRight: safeAreaInsetRight,
394
- safeAreaInsetBottom: safeAreaInsetBottom,
395
- safeAreaInsetLeft: safeAreaInsetLeft,
396
- onGestureStart: onGestureStart,
397
- onGestureCancel: onGestureCancel,
398
- onGestureEnd: onGestureEnd,
399
- headerHeight: headerHeight,
400
- isParentHeaderShown: isParentHeaderShown,
401
- onHeaderHeightChange: this.handleHeaderLayout,
391
+ children: [renderHeader({
392
+ mode: 'float',
393
+ layout,
394
+ scenes,
402
395
  getPreviousScene: this.getPreviousScene,
403
396
  getFocusedRoute: this.getFocusedRoute,
404
- headerDarkContent: headerDarkContent,
405
- hasAbsoluteFloatHeader: isFloatHeaderAbsolute && !headerTransparent,
406
- renderHeader: renderHeader,
407
- renderScene: renderScene,
408
- onOpenRoute: onOpenRoute,
409
- onCloseRoute: onCloseRoute,
410
- onTransitionStart: onTransitionStart,
411
- onTransitionEnd: onTransitionEnd,
412
- isNextScreenTransparent: isNextScreenTransparent,
413
- detachCurrentScreen: detachCurrentScreen
414
- }));
415
- })), isFloatHeaderAbsolute ? floatingHeader : null);
397
+ onContentHeightChange: this.handleHeaderLayout,
398
+ style: [styles.floating, isFloatHeaderAbsolute && [
399
+ // Without this, the header buttons won't be touchable on Android when headerTransparent: true
400
+ {
401
+ height: focusedHeaderHeight
402
+ }, styles.absolute]]
403
+ }), /*#__PURE__*/_jsx(MaybeScreenContainer, {
404
+ enabled: detachInactiveScreens,
405
+ style: styles.container,
406
+ onLayout: this.handleLayout,
407
+ children: [...routes, ...state.preloadedRoutes].map((route, index) => {
408
+ const focused = focusedRoute.key === route.key;
409
+ const gesture = gestures[route.key];
410
+ const scene = scenes[index];
411
+ // It is possible that for a short period the route appears in both arrays.
412
+ // Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.
413
+ // However, due to the router action, it immediately populates the `preloadedRoutes` array.
414
+ // Practically, the logic below takes care that it is rendered only once.
415
+ const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);
416
+ if (state.preloadedRoutes.includes(route) && routes.includes(route) && index >= routes.length) {
417
+ return null;
418
+ }
419
+ const {
420
+ headerShown = true,
421
+ headerTransparent,
422
+ freezeOnBlur,
423
+ autoHideHomeIndicator
424
+ } = scene.descriptor.options;
425
+ const safeAreaInsetTop = insets.top;
426
+ const safeAreaInsetRight = insets.right;
427
+ const safeAreaInsetBottom = insets.bottom;
428
+ const safeAreaInsetLeft = insets.left;
429
+ const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
430
+
431
+ // Start from current card and count backwards the number of cards with same interpolation
432
+ const interpolationIndex = getInterpolationIndex(scenes, index);
433
+ const isModal = getIsModal(scene, interpolationIndex, isParentModal);
434
+ const isNextScreenTransparent = scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';
435
+ const detachCurrentScreen = scenes[index + 1]?.descriptor.options.detachPreviousScreen !== false;
436
+ const activityState = isPreloaded ? STATE_INACTIVE : activeStates[index];
437
+ return /*#__PURE__*/_jsx(MaybeScreen, {
438
+ style: [StyleSheet.absoluteFill],
439
+ enabled: detachInactiveScreens,
440
+ active: activityState,
441
+ freezeOnBlur: freezeOnBlur,
442
+ shouldFreeze: activityState === STATE_INACTIVE && !isPreloaded,
443
+ homeIndicatorHidden: autoHideHomeIndicator,
444
+ pointerEvents: "box-none",
445
+ children: /*#__PURE__*/_jsx(CardContainer, {
446
+ index: index,
447
+ interpolationIndex: interpolationIndex,
448
+ modal: isModal,
449
+ active: index === routes.length - 1,
450
+ focused: focused,
451
+ opening: openingRouteKeys.includes(route.key),
452
+ closing: closingRouteKeys.includes(route.key),
453
+ layout: layout,
454
+ gesture: gesture,
455
+ scene: scene,
456
+ safeAreaInsetTop: safeAreaInsetTop,
457
+ safeAreaInsetRight: safeAreaInsetRight,
458
+ safeAreaInsetBottom: safeAreaInsetBottom,
459
+ safeAreaInsetLeft: safeAreaInsetLeft,
460
+ onGestureStart: onGestureStart,
461
+ onGestureCancel: onGestureCancel,
462
+ onGestureEnd: onGestureEnd,
463
+ headerHeight: headerHeight,
464
+ isParentHeaderShown: isParentHeaderShown,
465
+ onHeaderHeightChange: this.handleHeaderLayout,
466
+ getPreviousScene: this.getPreviousScene,
467
+ getFocusedRoute: this.getFocusedRoute,
468
+ hasAbsoluteFloatHeader: isFloatHeaderAbsolute && !headerTransparent,
469
+ renderHeader: renderHeader,
470
+ onOpenRoute: onOpenRoute,
471
+ onCloseRoute: onCloseRoute,
472
+ onTransitionStart: onTransitionStart,
473
+ onTransitionEnd: onTransitionEnd,
474
+ isNextScreenTransparent: isNextScreenTransparent,
475
+ detachCurrentScreen: detachCurrentScreen,
476
+ preloaded: isPreloaded
477
+ })
478
+ }, route.key);
479
+ })
480
+ })]
481
+ });
416
482
  }
417
483
  }
418
484
  const styles = StyleSheet.create({
@@ -422,8 +488,8 @@ const styles = StyleSheet.create({
422
488
  absolute: {
423
489
  position: 'absolute',
424
490
  top: 0,
425
- left: 0,
426
- right: 0
491
+ start: 0,
492
+ end: 0
427
493
  },
428
494
  floating: {
429
495
  zIndex: 1