@amazon-devices/react-navigation__stack 7.0.1758683737 → 8.0.9000000000

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 (273) hide show
  1. package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.bundle +13464 -0
  2. package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.map +4638 -0
  3. package/SystemModules/amzn__react-navigation__stack-8.modules.txt +32 -0
  4. package/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +92 -0
  5. package/SystemModules/keplerscript-system-bundle-config.json +4 -4
  6. package/kepler-compatibility.json +2 -4
  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 +241 -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/package.json +1 -1
  150. package/src/TransitionConfigs/CardStyleInterpolators.tsx +72 -6
  151. package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +43 -25
  152. package/src/TransitionConfigs/TransitionPresets.tsx +35 -5
  153. package/src/TransitionConfigs/TransitionSpecs.tsx +30 -2
  154. package/src/index.tsx +12 -7
  155. package/src/navigators/createStackNavigator.tsx +47 -63
  156. package/src/types.tsx +116 -24
  157. package/src/utils/CardAnimationContext.tsx +3 -3
  158. package/src/utils/GestureHandlerRefContext.tsx +2 -2
  159. package/src/utils/ModalPresentationContext.tsx +1 -3
  160. package/src/utils/conditional.tsx +1 -1
  161. package/src/utils/findLastIndex.tsx +2 -5
  162. package/src/utils/gestureActivationCriteria.tsx +70 -0
  163. package/src/utils/getDistanceForDirection.tsx +5 -4
  164. package/src/utils/getInvertedMultiplier.tsx +5 -6
  165. package/src/utils/getModalRoutesKeys.ts +21 -0
  166. package/src/utils/getShadowStyle.tsx +37 -0
  167. package/src/utils/throttle.tsx +16 -0
  168. package/src/utils/useCardAnimation.tsx +2 -2
  169. package/src/utils/useGestureHandlerRef.tsx +3 -3
  170. package/src/utils/useKeyboardManager.tsx +5 -7
  171. package/src/views/GestureHandler.kepler.tsx +1 -0
  172. package/src/views/GestureHandler.tsx +2 -2
  173. package/src/views/GestureHandlerNative.tsx +5 -5
  174. package/src/views/Header/Header.tsx +8 -7
  175. package/src/views/Header/HeaderContainer.tsx +23 -18
  176. package/src/views/Header/HeaderSegment.tsx +41 -43
  177. package/src/views/Screens.tsx +4 -2
  178. package/src/views/Stack/Card.tsx +480 -462
  179. package/src/views/Stack/CardA11yWrapper.tsx +67 -0
  180. package/src/views/Stack/CardContainer.tsx +127 -108
  181. package/src/views/Stack/CardContent.tsx +92 -0
  182. package/src/views/Stack/CardStack.tsx +370 -243
  183. package/src/views/Stack/StackView.tsx +73 -62
  184. package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.bundle +0 -28538
  185. package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.map +0 -1
  186. package/SystemModules/amzn__react-navigation__stack-7.modules.txt +0 -95
  187. package/SystemModules/amzn__react-navigation__stack-7.private.modules.txt +0 -185
  188. package/THIRD_PARTY_NOTICES.txt +0 -24
  189. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +0 -353
  190. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +0 -1
  191. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +0 -259
  192. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +0 -1
  193. package/lib/commonjs/TransitionConfigs/TransitionPresets.js +0 -134
  194. package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +0 -1
  195. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +0 -100
  196. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +0 -1
  197. package/lib/commonjs/index.js +0 -69
  198. package/lib/commonjs/index.js.map +0 -1
  199. package/lib/commonjs/navigators/createStackNavigator.js +0 -82
  200. package/lib/commonjs/navigators/createStackNavigator.js.map +0 -1
  201. package/lib/commonjs/types.js +0 -6
  202. package/lib/commonjs/types.js.map +0 -1
  203. package/lib/commonjs/utils/CardAnimationContext.js +0 -11
  204. package/lib/commonjs/utils/CardAnimationContext.js.map +0 -1
  205. package/lib/commonjs/utils/GestureHandlerRefContext.js +0 -11
  206. package/lib/commonjs/utils/GestureHandlerRefContext.js.map +0 -1
  207. package/lib/commonjs/utils/ModalPresentationContext.js +0 -12
  208. package/lib/commonjs/utils/ModalPresentationContext.js.map +0 -1
  209. package/lib/commonjs/utils/conditional.js +0 -32
  210. package/lib/commonjs/utils/conditional.js.map +0 -1
  211. package/lib/commonjs/utils/debounce.js +0 -19
  212. package/lib/commonjs/utils/debounce.js.map +0 -1
  213. package/lib/commonjs/utils/findLastIndex.js +0 -15
  214. package/lib/commonjs/utils/findLastIndex.js.map +0 -1
  215. package/lib/commonjs/utils/getDistanceForDirection.js +0 -20
  216. package/lib/commonjs/utils/getDistanceForDirection.js.map +0 -1
  217. package/lib/commonjs/utils/getInvertedMultiplier.js +0 -20
  218. package/lib/commonjs/utils/getInvertedMultiplier.js.map +0 -1
  219. package/lib/commonjs/utils/memoize.js +0 -33
  220. package/lib/commonjs/utils/memoize.js.map +0 -1
  221. package/lib/commonjs/utils/useCardAnimation.js +0 -19
  222. package/lib/commonjs/utils/useCardAnimation.js.map +0 -1
  223. package/lib/commonjs/utils/useGestureHandlerRef.js +0 -19
  224. package/lib/commonjs/utils/useGestureHandlerRef.js.map +0 -1
  225. package/lib/commonjs/utils/useKeyboardManager.js +0 -96
  226. package/lib/commonjs/utils/useKeyboardManager.js.map +0 -1
  227. package/lib/commonjs/views/GestureHandler.android.js +0 -17
  228. package/lib/commonjs/views/GestureHandler.android.js.map +0 -1
  229. package/lib/commonjs/views/GestureHandler.ios.js +0 -17
  230. package/lib/commonjs/views/GestureHandler.ios.js.map +0 -1
  231. package/lib/commonjs/views/GestureHandler.js +0 -24
  232. package/lib/commonjs/views/GestureHandler.js.map +0 -1
  233. package/lib/commonjs/views/GestureHandlerNative.js +0 -34
  234. package/lib/commonjs/views/GestureHandlerNative.js.map +0 -1
  235. package/lib/commonjs/views/Header/Header.js +0 -61
  236. package/lib/commonjs/views/Header/Header.js.map +0 -1
  237. package/lib/commonjs/views/Header/HeaderContainer.js +0 -127
  238. package/lib/commonjs/views/Header/HeaderContainer.js.map +0 -1
  239. package/lib/commonjs/views/Header/HeaderSegment.js +0 -139
  240. package/lib/commonjs/views/Header/HeaderSegment.js.map +0 -1
  241. package/lib/commonjs/views/ModalStatusBarManager.js +0 -42
  242. package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
  243. package/lib/commonjs/views/Screens.js +0 -44
  244. package/lib/commonjs/views/Screens.js.map +0 -1
  245. package/lib/commonjs/views/Stack/Card.js +0 -469
  246. package/lib/commonjs/views/Stack/Card.js.map +0 -1
  247. package/lib/commonjs/views/Stack/CardContainer.js +0 -259
  248. package/lib/commonjs/views/Stack/CardContainer.js.map +0 -1
  249. package/lib/commonjs/views/Stack/CardSheet.js +0 -54
  250. package/lib/commonjs/views/Stack/CardSheet.js.map +0 -1
  251. package/lib/commonjs/views/Stack/CardStack.js +0 -442
  252. package/lib/commonjs/views/Stack/CardStack.js.map +0 -1
  253. package/lib/commonjs/views/Stack/StackView.js +0 -333
  254. package/lib/commonjs/views/Stack/StackView.js.map +0 -1
  255. package/lib/module/utils/debounce.js.map +0 -1
  256. package/lib/module/utils/memoize.js +0 -27
  257. package/lib/module/utils/memoize.js.map +0 -1
  258. package/lib/module/views/ModalStatusBarManager.js +0 -34
  259. package/lib/module/views/ModalStatusBarManager.js.map +0 -1
  260. package/lib/module/views/Stack/CardSheet.js +0 -46
  261. package/lib/module/views/Stack/CardSheet.js.map +0 -1
  262. package/lib/typescript/src/utils/debounce.d.ts +0 -2
  263. package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
  264. package/lib/typescript/src/utils/memoize.d.ts +0 -2
  265. package/lib/typescript/src/utils/memoize.d.ts.map +0 -1
  266. package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -12
  267. package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
  268. package/lib/typescript/src/views/Stack/CardSheet.d.ts +0 -15
  269. package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +0 -1
  270. package/src/utils/debounce.tsx +0 -17
  271. package/src/utils/memoize.tsx +0 -33
  272. package/src/views/ModalStatusBarManager.tsx +0 -50
  273. 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,65 @@ 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
+ let activeScreensLimit = 1;
204
+ for (let i = props.routes.length - 1; i >= 0; i--) {
205
+ const {
206
+ options
207
+ } = scenes[i].descriptor;
208
+ const {
209
+ // By default, we don't want to detach the previous screen of the active one for modals
210
+ detachPreviousScreen = options.presentation === 'transparentModal' ? false : getIsModalPresentation(options.cardStyleInterpolator) ? i !== findLastIndex(scenes, scene => {
211
+ const {
212
+ cardStyleInterpolator
213
+ } = scene.descriptor.options;
214
+ return cardStyleInterpolator === forModalPresentationIOS || cardStyleInterpolator?.name === 'forModalPresentationIOS';
215
+ }) : true
216
+ } = options;
217
+ if (detachPreviousScreen === false) {
218
+ activeScreensLimit++;
219
+ } else {
220
+ // Check at least last 2 screens before stopping
221
+ // This will make sure that screen isn't detached when another screen is animating on top of the transparent one
222
+ // e.g. opaque -> transparent -> opaque
223
+ if (i <= props.routes.length - 2) {
224
+ break;
225
+ }
226
+ }
227
+ }
228
+ activeStates = props.routes.map((_, index, self) => {
229
+ // The activity state represents state of the screen:
230
+ // 0 - inactive, the screen is detached
231
+ // 1 - transitioning or below the top screen, the screen is mounted but interaction is disabled
232
+ // 2 - on top of the stack, the screen is mounted and interaction is enabled
233
+ let activityState;
234
+ const lastActiveState = state.activeStates[index];
235
+ const activeAfterTransition = index >= self.length - activeScreensLimit;
236
+ if (lastActiveState === STATE_INACTIVE && !activeAfterTransition) {
237
+ // screen was inactive before and it will still be inactive after the transition
238
+ activityState = STATE_INACTIVE;
239
+ } else {
240
+ const sceneForActivity = scenes[self.length - 1];
241
+ const outputValue = index === self.length - 1 ? STATE_ON_TOP // the screen is on top after the transition
242
+ : activeAfterTransition ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
243
+ : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
244
+
245
+ activityState = sceneForActivity ? sceneForActivity.progress.current.interpolate({
246
+ inputRange: [0, 1 - EPSILON, 1],
247
+ outputRange: [1, 1, outputValue],
248
+ extrapolate: 'clamp'
249
+ }) : STATE_TRANSITIONING_OR_BELOW_TOP;
250
+ }
251
+ return activityState;
252
+ });
253
+ }
157
254
  return {
158
255
  routes: props.routes,
159
256
  scenes,
160
257
  gestures,
161
258
  descriptors: props.descriptors,
259
+ activeStates,
162
260
  headerHeights: getHeaderHeights(scenes, props.insets, props.isParentHeaderShown, props.isParentModal, state.layout, state.headerHeights)
163
261
  };
164
262
  }
@@ -170,6 +268,7 @@ export default class CardStack extends React.Component {
170
268
  gestures: {},
171
269
  layout: SafeAreaProviderCompat.initialMetrics.frame,
172
270
  descriptors: this.props.descriptors,
271
+ activeStates: [],
173
272
  // Used when card's header is null and mode is float to make transition
174
273
  // between screens with headers and those without headers smooth.
175
274
  // This is not a great heuristic here. We don't know synchronously
@@ -245,11 +344,11 @@ export default class CardStack extends React.Component {
245
344
  insets,
246
345
  state,
247
346
  routes,
347
+ openingRouteKeys,
248
348
  closingRouteKeys,
249
349
  onOpenRoute,
250
350
  onCloseRoute,
251
351
  renderHeader,
252
- renderScene,
253
352
  isParentHeaderShown,
254
353
  isParentModal,
255
354
  onTransitionStart,
@@ -258,14 +357,14 @@ export default class CardStack extends React.Component {
258
357
  onGestureEnd,
259
358
  onGestureCancel,
260
359
  detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios' ||
261
- //amznmod_react add kepler platform
262
- //@ts-ignore
360
+ // @ts-ignore - accept kepler as a platform
263
361
  Platform.OS === 'kepler'
264
362
  } = this.props;
265
363
  const {
266
364
  scenes,
267
365
  layout,
268
366
  gestures,
367
+ activeStates,
269
368
  headerHeights
270
369
  } = this.state;
271
370
  const focusedRoute = state.routes[state.index];
@@ -282,137 +381,99 @@ export default class CardStack extends React.Component {
282
381
  }
283
382
  return false;
284
383
  });
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,
384
+ return /*#__PURE__*/_jsxs(View, {
327
385
  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,
386
+ children: [renderHeader({
387
+ mode: 'float',
388
+ layout,
389
+ scenes,
402
390
  getPreviousScene: this.getPreviousScene,
403
391
  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);
392
+ onContentHeightChange: this.handleHeaderLayout,
393
+ style: [styles.floating, isFloatHeaderAbsolute && [
394
+ // Without this, the header buttons won't be touchable on Android when headerTransparent: true
395
+ {
396
+ height: focusedHeaderHeight
397
+ }, styles.absolute]]
398
+ }), /*#__PURE__*/_jsx(MaybeScreenContainer, {
399
+ enabled: detachInactiveScreens,
400
+ style: styles.container,
401
+ onLayout: this.handleLayout,
402
+ children: [...routes, ...state.preloadedRoutes].map((route, index) => {
403
+ const focused = focusedRoute.key === route.key;
404
+ const gesture = gestures[route.key];
405
+ const scene = scenes[index];
406
+ // It is possible that for a short period the route appears in both arrays.
407
+ // Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.
408
+ // However, due to the router action, it immediately populates the `preloadedRoutes` array.
409
+ // Practically, the logic below takes care that it is rendered only once.
410
+ const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);
411
+ if (state.preloadedRoutes.includes(route) && routes.includes(route) && index >= routes.length) {
412
+ return null;
413
+ }
414
+ const {
415
+ headerShown = true,
416
+ headerTransparent,
417
+ freezeOnBlur,
418
+ autoHideHomeIndicator
419
+ } = scene.descriptor.options;
420
+ const safeAreaInsetTop = insets.top;
421
+ const safeAreaInsetRight = insets.right;
422
+ const safeAreaInsetBottom = insets.bottom;
423
+ const safeAreaInsetLeft = insets.left;
424
+ const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
425
+
426
+ // Start from current card and count backwards the number of cards with same interpolation
427
+ const interpolationIndex = getInterpolationIndex(scenes, index);
428
+ const isModal = getIsModal(scene, interpolationIndex, isParentModal);
429
+ const isNextScreenTransparent = scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';
430
+ const detachCurrentScreen = scenes[index + 1]?.descriptor.options.detachPreviousScreen !== false;
431
+ const activityState = isPreloaded ? STATE_INACTIVE : activeStates[index];
432
+ return /*#__PURE__*/_jsx(MaybeScreen, {
433
+ style: [StyleSheet.absoluteFill],
434
+ enabled: detachInactiveScreens,
435
+ active: activityState,
436
+ freezeOnBlur: freezeOnBlur,
437
+ shouldFreeze: activityState === STATE_INACTIVE && !isPreloaded,
438
+ homeIndicatorHidden: autoHideHomeIndicator,
439
+ pointerEvents: "box-none",
440
+ children: /*#__PURE__*/_jsx(CardContainer, {
441
+ index: index,
442
+ interpolationIndex: interpolationIndex,
443
+ modal: isModal,
444
+ active: index === routes.length - 1,
445
+ focused: focused,
446
+ opening: openingRouteKeys.includes(route.key),
447
+ closing: closingRouteKeys.includes(route.key),
448
+ layout: layout,
449
+ gesture: gesture,
450
+ scene: scene,
451
+ safeAreaInsetTop: safeAreaInsetTop,
452
+ safeAreaInsetRight: safeAreaInsetRight,
453
+ safeAreaInsetBottom: safeAreaInsetBottom,
454
+ safeAreaInsetLeft: safeAreaInsetLeft,
455
+ onGestureStart: onGestureStart,
456
+ onGestureCancel: onGestureCancel,
457
+ onGestureEnd: onGestureEnd,
458
+ headerHeight: headerHeight,
459
+ isParentHeaderShown: isParentHeaderShown,
460
+ onHeaderHeightChange: this.handleHeaderLayout,
461
+ getPreviousScene: this.getPreviousScene,
462
+ getFocusedRoute: this.getFocusedRoute,
463
+ hasAbsoluteFloatHeader: isFloatHeaderAbsolute && !headerTransparent,
464
+ renderHeader: renderHeader,
465
+ onOpenRoute: onOpenRoute,
466
+ onCloseRoute: onCloseRoute,
467
+ onTransitionStart: onTransitionStart,
468
+ onTransitionEnd: onTransitionEnd,
469
+ isNextScreenTransparent: isNextScreenTransparent,
470
+ detachCurrentScreen: detachCurrentScreen,
471
+ preloaded: isPreloaded
472
+ })
473
+ }, route.key);
474
+ })
475
+ })]
476
+ });
416
477
  }
417
478
  }
418
479
  const styles = StyleSheet.create({
@@ -422,8 +483,8 @@ const styles = StyleSheet.create({
422
483
  absolute: {
423
484
  position: 'absolute',
424
485
  top: 0,
425
- left: 0,
426
- right: 0
486
+ start: 0,
487
+ end: 0
427
488
  },
428
489
  floating: {
429
490
  zIndex: 1