@amazon-devices/react-navigation__stack 7.0.1759135970 → 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 -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 +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,203 +1,184 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
1
+ "use strict";
2
+
2
3
  import Color from 'color';
3
4
  import * as React from 'react';
4
5
  import { Animated, InteractionManager, Platform, StyleSheet, View } from 'react-native';
5
- import { forModalPresentationIOS } from '../../TransitionConfigs/CardStyleInterpolators';
6
- import CardAnimationContext from '../../utils/CardAnimationContext';
7
- import getDistanceForDirection from '../../utils/getDistanceForDirection';
8
- import getInvertedMultiplier from '../../utils/getInvertedMultiplier';
9
- import memoize from '../../utils/memoize';
6
+ import useLatestCallback from 'use-latest-callback';
7
+ import { CardAnimationContext } from "../../utils/CardAnimationContext.js";
8
+ import { gestureActivationCriteria } from "../../utils/gestureActivationCriteria.js";
9
+ import { getDistanceForDirection } from "../../utils/getDistanceForDirection.js";
10
+ import { getInvertedMultiplier } from "../../utils/getInvertedMultiplier.js";
11
+ import { getShadowStyle } from "../../utils/getShadowStyle.js";
10
12
  import { GestureState, PanGestureHandler } from '../GestureHandler';
11
- import ModalStatusBarManager from '../ModalStatusBarManager';
12
- import CardSheet from './CardSheet';
13
+ import { CardContent } from "./CardContent.js";
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
15
  const GESTURE_VELOCITY_IMPACT = 0.3;
14
16
  const TRUE = 1;
15
17
  const FALSE = 0;
16
-
17
- /**
18
- * The distance of touch start from the edge of the screen where the gesture will be recognized
19
- */
20
- const GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 50;
21
- const GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;
22
18
  const useNativeDriver = Platform.OS !== 'web';
23
19
  const hasOpacityStyle = style => {
24
20
  if (style) {
25
21
  const flattenedStyle = StyleSheet.flatten(style);
26
- return flattenedStyle.opacity != null;
22
+ return 'opacity' in flattenedStyle && flattenedStyle.opacity != null;
27
23
  }
28
24
  return false;
29
25
  };
30
- export default class Card extends React.Component {
31
- static defaultProps = {
32
- shadowEnabled: false,
33
- gestureEnabled: true,
34
- gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
35
- overlay: ({
36
- style
37
- }) => style ? /*#__PURE__*/React.createElement(Animated.View, {
38
- pointerEvents: "none",
39
- style: [styles.overlay, style]
40
- }) : null
41
- };
42
- componentDidMount() {
43
- this.animate({
44
- closing: this.props.closing
45
- });
46
- this.isCurrentlyMounted = true;
26
+ const getAnimateToValue = ({
27
+ closing: isClosing,
28
+ layout: currentLayout,
29
+ gestureDirection: currentGestureDirection,
30
+ direction: currentDirection,
31
+ preloaded: isPreloaded
32
+ }) => {
33
+ if (!isClosing && !isPreloaded) {
34
+ return 0;
47
35
  }
48
- componentDidUpdate(prevProps) {
49
- const {
50
- layout,
51
- gestureDirection,
52
- closing
53
- } = this.props;
54
- const {
55
- width,
56
- height
57
- } = layout;
58
- if (width !== prevProps.layout.width) {
59
- this.layout.width.setValue(width);
60
- }
61
- if (height !== prevProps.layout.height) {
62
- this.layout.height.setValue(height);
63
- }
64
- if (gestureDirection !== prevProps.gestureDirection) {
65
- this.inverted.setValue(getInvertedMultiplier(gestureDirection));
36
+ return getDistanceForDirection(currentLayout, currentGestureDirection, currentDirection === 'rtl');
37
+ };
38
+ const defaultOverlay = ({
39
+ style
40
+ }) => style ? /*#__PURE__*/_jsx(Animated.View, {
41
+ pointerEvents: "none",
42
+ style: [styles.overlay, style]
43
+ }) : null;
44
+ function Card({
45
+ shadowEnabled = false,
46
+ gestureEnabled = true,
47
+ gestureVelocityImpact = GESTURE_VELOCITY_IMPACT,
48
+ overlay = defaultOverlay,
49
+ animated,
50
+ interpolationIndex,
51
+ opening,
52
+ closing,
53
+ next,
54
+ current,
55
+ gesture,
56
+ layout,
57
+ insets,
58
+ direction,
59
+ pageOverflowEnabled,
60
+ gestureDirection,
61
+ onOpen,
62
+ onClose,
63
+ onTransition,
64
+ onGestureBegin,
65
+ onGestureCanceled,
66
+ onGestureEnd,
67
+ children,
68
+ overlayEnabled,
69
+ gestureResponseDistance,
70
+ transitionSpec,
71
+ preloaded,
72
+ styleInterpolator,
73
+ containerStyle: customContainerStyle,
74
+ contentStyle
75
+ }) {
76
+ const [, forceUpdate] = React.useReducer(x => x + 1, 0);
77
+ const didInitiallyAnimate = React.useRef(false);
78
+ const lastToValueRef = React.useRef(undefined);
79
+ const interactionHandleRef = React.useRef(undefined);
80
+ const animationHandleRef = React.useRef(undefined);
81
+ const pendingGestureCallbackRef = React.useRef(undefined);
82
+ const [isClosing] = React.useState(() => new Animated.Value(FALSE));
83
+ const [inverted] = React.useState(() => new Animated.Value(getInvertedMultiplier(gestureDirection, direction === 'rtl')));
84
+ const [layoutAnim] = React.useState(() => ({
85
+ width: new Animated.Value(layout.width),
86
+ height: new Animated.Value(layout.height)
87
+ }));
88
+ const [isSwiping] = React.useState(() => new Animated.Value(FALSE));
89
+ const onStartInteraction = useLatestCallback(() => {
90
+ if (interactionHandleRef.current === undefined) {
91
+ interactionHandleRef.current = InteractionManager.createInteractionHandle();
66
92
  }
67
- const toValue = this.getAnimateToValue(this.props);
68
- if (this.getAnimateToValue(prevProps) !== toValue || this.lastToValue !== toValue) {
69
- // We need to trigger the animation when route was closed
70
- // Thr route might have been closed by a `POP` action or by a gesture
71
- // When route was closed due to a gesture, the animation would've happened already
72
- // It's still important to trigger the animation so that `onClose` is called
73
- // If `onClose` is not called, cleanup step won't be performed for gestures
74
- this.animate({
75
- closing
76
- });
93
+ });
94
+ const onEndInteraction = useLatestCallback(() => {
95
+ if (interactionHandleRef.current !== undefined) {
96
+ InteractionManager.clearInteractionHandle(interactionHandleRef.current);
97
+ interactionHandleRef.current = undefined;
77
98
  }
78
- }
79
- componentWillUnmount() {
80
- this.props.gesture.stopAnimation();
81
- this.isCurrentlyMounted = false;
82
- this.handleEndInteraction();
83
- }
84
- isCurrentlyMounted = false;
85
- isClosing = new Animated.Value(FALSE);
86
- inverted = new Animated.Value(getInvertedMultiplier(this.props.gestureDirection));
87
- layout = {
88
- width: new Animated.Value(this.props.layout.width),
89
- height: new Animated.Value(this.props.layout.height)
90
- };
91
- isSwiping = new Animated.Value(FALSE);
92
- animate = ({
93
- closing,
99
+ });
100
+ const animate = useLatestCallback(({
101
+ closing: isClosingParam,
94
102
  velocity
95
103
  }) => {
96
- const {
97
- gesture,
98
- transitionSpec,
99
- onOpen,
100
- onClose,
101
- onTransition
102
- } = this.props;
103
- const toValue = this.getAnimateToValue({
104
- ...this.props,
105
- closing
104
+ const toValue = getAnimateToValue({
105
+ closing: isClosingParam,
106
+ layout,
107
+ gestureDirection,
108
+ direction,
109
+ preloaded
106
110
  });
107
- this.lastToValue = toValue;
108
- this.isClosing.setValue(closing ? TRUE : FALSE);
109
- const spec = closing ? transitionSpec.close : transitionSpec.open;
111
+ lastToValueRef.current = toValue;
112
+ isClosing.setValue(isClosingParam ? TRUE : FALSE);
113
+ const spec = isClosingParam ? transitionSpec.close : transitionSpec.open;
110
114
  const animation = spec.animation === 'spring' ? Animated.spring : Animated.timing;
111
- this.setPointerEventsEnabled(!closing);
112
- this.handleStartInteraction();
113
- clearTimeout(this.pendingGestureCallback);
114
- onTransition === null || onTransition === void 0 || onTransition({
115
- closing,
115
+ clearTimeout(pendingGestureCallbackRef.current);
116
+ if (animationHandleRef.current !== undefined) {
117
+ cancelAnimationFrame(animationHandleRef.current);
118
+ }
119
+ onTransition?.({
120
+ closing: isClosingParam,
116
121
  gesture: velocity !== undefined
117
122
  });
118
- animation(gesture, {
119
- ...spec.config,
120
- velocity,
121
- toValue,
122
- useNativeDriver,
123
- isInteraction: false
124
- }).start(({
125
- finished
126
- }) => {
127
- this.handleEndInteraction();
128
- clearTimeout(this.pendingGestureCallback);
129
- if (finished) {
130
- if (closing) {
131
- onClose();
132
- } else {
133
- onOpen();
134
- }
135
- if (this.isCurrentlyMounted) {
123
+ const onFinish = () => {
124
+ if (isClosingParam) {
125
+ onClose();
126
+ } else {
127
+ onOpen();
128
+ }
129
+ animationHandleRef.current = requestAnimationFrame(() => {
130
+ if (didInitiallyAnimate.current) {
136
131
  // Make sure to re-open screen if it wasn't removed
137
- this.forceUpdate();
132
+ forceUpdate();
138
133
  }
139
- }
140
- });
141
- };
142
- getAnimateToValue = ({
143
- closing,
144
- layout,
145
- gestureDirection
146
- }) => {
147
- if (!closing) {
148
- return 0;
149
- }
150
- return getDistanceForDirection(layout, gestureDirection);
151
- };
152
- setPointerEventsEnabled = enabled => {
153
- var _this$ref$current;
154
- const pointerEvents = enabled ? 'box-none' : 'none';
155
- (_this$ref$current = this.ref.current) === null || _this$ref$current === void 0 || _this$ref$current.setPointerEvents(pointerEvents);
156
- };
157
- handleStartInteraction = () => {
158
- if (this.interactionHandle === undefined) {
159
- this.interactionHandle = InteractionManager.createInteractionHandle();
160
- }
161
- };
162
- handleEndInteraction = () => {
163
- if (this.interactionHandle !== undefined) {
164
- InteractionManager.clearInteractionHandle(this.interactionHandle);
165
- this.interactionHandle = undefined;
134
+ });
135
+ };
136
+ if (animated) {
137
+ onStartInteraction();
138
+ animation(gesture, {
139
+ ...spec.config,
140
+ velocity,
141
+ toValue,
142
+ useNativeDriver,
143
+ isInteraction: false
144
+ }).start(({
145
+ finished
146
+ }) => {
147
+ onEndInteraction();
148
+ clearTimeout(pendingGestureCallbackRef.current);
149
+ if (finished) {
150
+ onFinish();
151
+ }
152
+ });
153
+ } else {
154
+ onFinish();
166
155
  }
167
- };
168
- handleGestureStateChange = ({
156
+ });
157
+ const onGestureStateChange = useLatestCallback(({
169
158
  nativeEvent
170
159
  }) => {
171
- const {
172
- layout,
173
- onClose,
174
- onGestureBegin,
175
- onGestureCanceled,
176
- onGestureEnd,
177
- gestureDirection,
178
- gestureVelocityImpact
179
- } = this.props;
180
160
  switch (nativeEvent.state) {
181
161
  case GestureState.ACTIVE:
182
- this.isSwiping.setValue(TRUE);
183
- this.handleStartInteraction();
184
- onGestureBegin === null || onGestureBegin === void 0 || onGestureBegin();
162
+ isSwiping.setValue(TRUE);
163
+ onStartInteraction();
164
+ onGestureBegin?.();
185
165
  break;
186
166
  case GestureState.CANCELLED:
167
+ case GestureState.FAILED:
187
168
  {
188
- this.isSwiping.setValue(FALSE);
189
- this.handleEndInteraction();
169
+ isSwiping.setValue(FALSE);
170
+ onEndInteraction();
190
171
  const velocity = gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? nativeEvent.velocityY : nativeEvent.velocityX;
191
- this.animate({
192
- closing: this.props.closing,
172
+ animate({
173
+ closing,
193
174
  velocity
194
175
  });
195
- onGestureCanceled === null || onGestureCanceled === void 0 || onGestureCanceled();
176
+ onGestureCanceled?.();
196
177
  break;
197
178
  }
198
179
  case GestureState.END:
199
180
  {
200
- this.isSwiping.setValue(FALSE);
181
+ isSwiping.setValue(FALSE);
201
182
  let distance;
202
183
  let translation;
203
184
  let velocity;
@@ -210,33 +191,103 @@ export default class Card extends React.Component {
210
191
  translation = nativeEvent.translationX;
211
192
  velocity = nativeEvent.velocityX;
212
193
  }
213
- const closing = (translation + velocity * gestureVelocityImpact) * getInvertedMultiplier(gestureDirection) > distance / 2 ? velocity !== 0 || translation !== 0 : this.props.closing;
214
- this.animate({
215
- closing,
194
+ const shouldClose = (translation + velocity * gestureVelocityImpact) * getInvertedMultiplier(gestureDirection, direction === 'rtl') > distance / 2 ? velocity !== 0 || translation !== 0 : closing;
195
+ animate({
196
+ closing: shouldClose,
216
197
  velocity
217
198
  });
218
- if (closing) {
199
+ if (shouldClose) {
219
200
  // We call onClose with a delay to make sure that the animation has already started
220
201
  // This will make sure that the state update caused by this doesn't affect start of animation
221
- this.pendingGestureCallback = setTimeout(() => {
202
+ pendingGestureCallbackRef.current = setTimeout(() => {
222
203
  onClose();
223
204
 
224
205
  // Trigger an update after we dispatch the action to remove the screen
225
206
  // This will make sure that we check if the screen didn't get removed so we can cancel the animation
226
- this.forceUpdate();
207
+ forceUpdate();
227
208
  }, 32);
228
209
  }
229
- onGestureEnd === null || onGestureEnd === void 0 || onGestureEnd();
210
+ onGestureEnd?.();
230
211
  break;
231
212
  }
232
213
  }
233
- };
234
-
235
- // Memoize this to avoid extra work on re-render
236
- getInterpolatedStyle = memoize((styleInterpolator, animation) => styleInterpolator(animation));
214
+ });
215
+ React.useLayoutEffect(() => {
216
+ layoutAnim.width.setValue(layout.width);
217
+ layoutAnim.height.setValue(layout.height);
218
+ inverted.setValue(getInvertedMultiplier(gestureDirection, direction === 'rtl'));
219
+ }, [gestureDirection, direction, inverted, layoutAnim.width, layoutAnim.height, layout.width, layout.height]);
220
+ const previousPropsRef = React.useRef(null);
221
+ React.useEffect(() => {
222
+ return () => {
223
+ onEndInteraction();
224
+ if (animationHandleRef.current) {
225
+ cancelAnimationFrame(animationHandleRef.current);
226
+ }
227
+ clearTimeout(pendingGestureCallbackRef.current);
228
+ };
237
229
 
238
- // Keep track of the animation context when deps changes.
239
- getCardAnimation = memoize((interpolationIndex, current, next, layout, insetTop, insetRight, insetBottom, insetLeft) => ({
230
+ // We only want to clean up the animation on unmount
231
+ // eslint-disable-next-line react-hooks/exhaustive-deps
232
+ }, []);
233
+ const timeoutRef = React.useRef(null);
234
+ React.useEffect(() => {
235
+ if (preloaded) {
236
+ return;
237
+ }
238
+ if (!didInitiallyAnimate.current) {
239
+ // Animate the card in on initial mount
240
+ // Wrap in setTimeout to ensure animation starts after
241
+ // rending of the screen is done. This is especially important
242
+ // in the new architecture
243
+ // cf., https://github.com/react-navigation/react-navigation/issues/12401
244
+ if (timeoutRef.current) {
245
+ clearTimeout(timeoutRef.current);
246
+ }
247
+ timeoutRef.current = setTimeout(() => {
248
+ didInitiallyAnimate.current = true;
249
+ animate({
250
+ closing
251
+ });
252
+ }, 0);
253
+ } else {
254
+ const previousOpening = previousPropsRef.current?.opening;
255
+ const previousToValue = previousPropsRef.current ? getAnimateToValue(previousPropsRef.current) : null;
256
+ const toValue = getAnimateToValue({
257
+ closing,
258
+ layout,
259
+ gestureDirection,
260
+ direction,
261
+ preloaded
262
+ });
263
+ if (previousToValue !== toValue || lastToValueRef.current !== toValue) {
264
+ // We need to trigger the animation when route was closed
265
+ // The route might have been closed by a `POP` action or by a gesture
266
+ // When route was closed due to a gesture, the animation would've happened already
267
+ // It's still important to trigger the animation so that `onClose` is called
268
+ // If `onClose` is not called, cleanup step won't be performed for gestures
269
+ animate({
270
+ closing
271
+ });
272
+ } else if (typeof previousOpening === 'boolean' && opening && !previousOpening) {
273
+ // This can happen when screen somewhere below in the stack comes into focus via rearranging
274
+ // Also reset the animated value to make sure that the animation starts from the beginning
275
+ gesture.setValue(getDistanceForDirection(layout, gestureDirection, direction === 'rtl'));
276
+ animate({
277
+ closing
278
+ });
279
+ }
280
+ }
281
+ previousPropsRef.current = {
282
+ opening,
283
+ closing,
284
+ layout,
285
+ gestureDirection,
286
+ direction,
287
+ preloaded
288
+ };
289
+ }, [animate, closing, direction, gesture, gestureDirection, layout, opening, preloaded]);
290
+ const interpolationProps = React.useMemo(() => ({
240
291
  index: interpolationIndex,
241
292
  current: {
242
293
  progress: current
@@ -244,123 +295,41 @@ export default class Card extends React.Component {
244
295
  next: next && {
245
296
  progress: next
246
297
  },
247
- closing: this.isClosing,
248
- swiping: this.isSwiping,
249
- inverted: this.inverted,
298
+ closing: isClosing,
299
+ swiping: isSwiping,
300
+ inverted,
250
301
  layouts: {
251
302
  screen: layout
252
303
  },
253
304
  insets: {
254
- top: insetTop,
255
- right: insetRight,
256
- bottom: insetBottom,
257
- left: insetLeft
305
+ top: insets.top,
306
+ right: insets.right,
307
+ bottom: insets.bottom,
308
+ left: insets.left
258
309
  }
259
- }));
260
- gestureActivationCriteria() {
261
- const {
262
- layout,
263
- gestureDirection,
264
- gestureResponseDistance
265
- } = this.props;
266
- const enableTrackpadTwoFingerGesture = true;
267
- const distance = gestureResponseDistance !== undefined ? gestureResponseDistance : gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? GESTURE_RESPONSE_DISTANCE_VERTICAL : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
268
- if (gestureDirection === 'vertical') {
269
- return {
270
- maxDeltaX: 15,
271
- minOffsetY: 5,
272
- hitSlop: {
273
- bottom: -layout.height + distance
274
- },
275
- enableTrackpadTwoFingerGesture
276
- };
277
- } else if (gestureDirection === 'vertical-inverted') {
278
- return {
279
- maxDeltaX: 15,
280
- minOffsetY: -5,
281
- hitSlop: {
282
- top: -layout.height + distance
283
- },
284
- enableTrackpadTwoFingerGesture
285
- };
286
- } else {
287
- const hitSlop = -layout.width + distance;
288
- const invertedMultiplier = getInvertedMultiplier(gestureDirection);
289
- if (invertedMultiplier === 1) {
290
- return {
291
- minOffsetX: 5,
292
- maxDeltaY: 20,
293
- hitSlop: {
294
- right: hitSlop
295
- },
296
- enableTrackpadTwoFingerGesture
297
- };
298
- } else {
299
- return {
300
- minOffsetX: -5,
301
- maxDeltaY: 20,
302
- hitSlop: {
303
- left: hitSlop
304
- },
305
- enableTrackpadTwoFingerGesture
306
- };
307
- }
310
+ }), [interpolationIndex, current, next, isClosing, isSwiping, inverted, layout, insets.top, insets.right, insets.bottom, insets.left]);
311
+ const {
312
+ containerStyle,
313
+ cardStyle,
314
+ overlayStyle,
315
+ shadowStyle
316
+ } = React.useMemo(() => styleInterpolator(interpolationProps), [styleInterpolator, interpolationProps]);
317
+ const onGestureEvent = React.useMemo(() => gestureEnabled ? Animated.event([{
318
+ nativeEvent: gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? {
319
+ translationY: gesture
320
+ } : {
321
+ translationX: gesture
308
322
  }
309
- }
310
- ref = /*#__PURE__*/React.createRef();
311
- render() {
312
- const {
313
- styleInterpolator,
314
- interpolationIndex,
315
- current,
316
- gesture,
317
- next,
318
- layout,
319
- insets,
320
- overlay,
321
- overlayEnabled,
322
- shadowEnabled,
323
- gestureEnabled,
324
- gestureDirection,
325
- pageOverflowEnabled,
326
- headerDarkContent,
327
- children,
328
- containerStyle: customContainerStyle,
329
- contentStyle,
330
- ...rest
331
- } = this.props;
332
- const interpolationProps = this.getCardAnimation(interpolationIndex, current, next, layout, insets.top, insets.right, insets.bottom, insets.left);
333
- const interpolatedStyle = this.getInterpolatedStyle(styleInterpolator, interpolationProps);
334
- const {
335
- containerStyle,
336
- cardStyle,
337
- overlayStyle,
338
- shadowStyle
339
- } = interpolatedStyle;
340
- const handleGestureEvent = gestureEnabled ? Animated.event([{
341
- nativeEvent: gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? {
342
- translationY: gesture
343
- } : {
344
- translationX: gesture
345
- }
346
- }], {
347
- useNativeDriver
348
- }) : undefined;
349
- const {
350
- backgroundColor
351
- } = StyleSheet.flatten(contentStyle || {});
352
- const isTransparent = typeof backgroundColor === 'string' ? Color(backgroundColor).alpha() === 0 : false;
353
- return /*#__PURE__*/React.createElement(CardAnimationContext.Provider, {
354
- value: interpolationProps
355
- },
356
- // StatusBar messes with translucent status bar on Android
357
- // So we should only enable it on iOS
358
- Platform.OS === 'ios' && overlayEnabled && next && getIsModalPresentation(styleInterpolator) ? /*#__PURE__*/React.createElement(ModalStatusBarManager, {
359
- dark: headerDarkContent,
360
- layout: layout,
361
- insets: insets,
362
- style: cardStyle
363
- }) : null, /*#__PURE__*/React.createElement(Animated.View, {
323
+ }], {
324
+ useNativeDriver
325
+ }) : undefined, [gesture, gestureDirection, gestureEnabled]);
326
+ const {
327
+ backgroundColor
328
+ } = StyleSheet.flatten(contentStyle || {});
329
+ const isTransparent = typeof backgroundColor === 'string' ? Color(backgroundColor).alpha() === 0 : false;
330
+ return /*#__PURE__*/_jsxs(CardAnimationContext.Provider, {
331
+ value: interpolationProps,
332
+ children: [Platform.OS !== 'web' ? /*#__PURE__*/_jsx(Animated.View, {
364
333
  style: {
365
334
  // This is a dummy style that doesn't actually change anything visually.
366
335
  // Animated needs the animated value to be used somewhere, otherwise things don't update properly.
@@ -371,45 +340,46 @@ export default class Card extends React.Component {
371
340
  // Make sure that this view isn't removed. If this view is removed, our style with animated value won't apply
372
341
  ,
373
342
  collapsable: false
374
- }), /*#__PURE__*/React.createElement(View, _extends({
375
- pointerEvents: "box-none"
376
- // Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
377
- // This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
378
- ,
379
- collapsable: false
380
- }, rest), overlayEnabled ? /*#__PURE__*/React.createElement(View, {
343
+ }) : null, overlayEnabled ? /*#__PURE__*/_jsx(View, {
344
+ pointerEvents: "box-none",
345
+ style: StyleSheet.absoluteFill,
346
+ children: overlay({
347
+ style: overlayStyle
348
+ })
349
+ }) : null, /*#__PURE__*/_jsx(Animated.View, {
381
350
  pointerEvents: "box-none",
382
- style: StyleSheet.absoluteFill
383
- }, overlay({
384
- style: overlayStyle
385
- })) : null, /*#__PURE__*/React.createElement(Animated.View, {
386
351
  style: [styles.container, containerStyle, customContainerStyle],
387
- pointerEvents: "box-none"
388
- }, /*#__PURE__*/React.createElement(PanGestureHandler, _extends({
389
- enabled: layout.width !== 0 && gestureEnabled,
390
- onGestureEvent: handleGestureEvent,
391
- onHandlerStateChange: this.handleGestureStateChange
392
- }, this.gestureActivationCriteria()), /*#__PURE__*/React.createElement(Animated.View, {
393
- needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),
394
- style: [styles.container, cardStyle]
395
- }, shadowEnabled && shadowStyle && !isTransparent ? /*#__PURE__*/React.createElement(Animated.View, {
396
- style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowLeft] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowRight] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {
397
- backgroundColor
398
- }, shadowStyle],
399
- pointerEvents: "none"
400
- }) : null, /*#__PURE__*/React.createElement(CardSheet, {
401
- ref: this.ref,
402
- enabled: pageOverflowEnabled,
403
- layout: layout,
404
- style: contentStyle
405
- }, children))))));
406
- }
352
+ children: /*#__PURE__*/_jsx(PanGestureHandler, {
353
+ enabled: layout.width !== 0 && gestureEnabled,
354
+ onGestureEvent: onGestureEvent,
355
+ onHandlerStateChange: onGestureStateChange,
356
+ ...gestureActivationCriteria({
357
+ layout,
358
+ direction,
359
+ gestureDirection,
360
+ gestureResponseDistance
361
+ }),
362
+ children: /*#__PURE__*/_jsxs(Animated.View, {
363
+ pointerEvents: "box-none",
364
+ needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),
365
+ style: [styles.container, cardStyle],
366
+ children: [shadowEnabled && shadowStyle && !isTransparent ? /*#__PURE__*/_jsx(Animated.View, {
367
+ pointerEvents: "none",
368
+ style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowStart] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowEnd] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {
369
+ backgroundColor
370
+ }, shadowStyle]
371
+ }) : null, /*#__PURE__*/_jsx(CardContent, {
372
+ enabled: pageOverflowEnabled,
373
+ layout: layout,
374
+ style: contentStyle,
375
+ children: children
376
+ })]
377
+ })
378
+ })
379
+ })]
380
+ });
407
381
  }
408
- export const getIsModalPresentation = cardStyleInterpolator => {
409
- return cardStyleInterpolator === forModalPresentationIOS ||
410
- // Handle custom modal presentation interpolators as well
411
- cardStyleInterpolator.name === 'forModalPresentationIOS';
412
- };
382
+ export { Card };
413
383
  const styles = StyleSheet.create({
414
384
  container: {
415
385
  flex: 1
@@ -419,34 +389,39 @@ const styles = StyleSheet.create({
419
389
  backgroundColor: '#000'
420
390
  },
421
391
  shadow: {
422
- position: 'absolute',
423
- shadowRadius: 5,
424
- shadowColor: '#000',
425
- shadowOpacity: 0.3
392
+ position: 'absolute'
426
393
  },
427
394
  shadowHorizontal: {
428
395
  top: 0,
429
396
  bottom: 0,
430
397
  width: 3,
431
- shadowOffset: {
432
- width: -1,
433
- height: 1
434
- }
398
+ ...getShadowStyle({
399
+ offset: {
400
+ width: -1,
401
+ height: 1
402
+ },
403
+ radius: 5,
404
+ opacity: 0.3
405
+ })
435
406
  },
436
- shadowLeft: {
437
- left: 0
407
+ shadowStart: {
408
+ start: 0
438
409
  },
439
- shadowRight: {
440
- right: 0
410
+ shadowEnd: {
411
+ end: 0
441
412
  },
442
413
  shadowVertical: {
443
- left: 0,
444
- right: 0,
414
+ start: 0,
415
+ end: 0,
445
416
  height: 3,
446
- shadowOffset: {
447
- width: 1,
448
- height: -1
449
- }
417
+ ...getShadowStyle({
418
+ offset: {
419
+ width: 1,
420
+ height: -1
421
+ },
422
+ radius: 5,
423
+ opacity: 0.3
424
+ })
450
425
  },
451
426
  shadowTop: {
452
427
  top: 0