@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.
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.bundle +13464 -0
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.map +4638 -0
- package/SystemModules/amzn__react-navigation__stack-8.modules.txt +32 -0
- package/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +92 -0
- package/SystemModules/keplerscript-system-bundle-config.json +4 -4
- package/kepler-compatibility.json +2 -2
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +57 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +30 -16
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js +32 -4
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js +32 -2
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/module/index.js +13 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +46 -48
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/CardAnimationContext.js +3 -1
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js +3 -1
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js +3 -2
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js +3 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/findLastIndex.js +4 -2
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/gestureActivationCriteria.js +60 -0
- package/lib/module/utils/gestureActivationCriteria.js.map +1 -0
- package/lib/module/utils/getDistanceForDirection.js +5 -3
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js +5 -4
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/getModalRoutesKeys.js +12 -0
- package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/module/utils/getShadowStyle.js +24 -0
- package/lib/module/utils/getShadowStyle.js.map +1 -0
- package/lib/module/utils/{debounce.js → throttle.js} +5 -4
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/module/utils/useCardAnimation.js +4 -2
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js +5 -3
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js +8 -6
- package/lib/module/utils/useKeyboardManager.js.map +1 -1
- package/lib/module/views/GestureHandler.android.js +3 -1
- package/lib/module/views/GestureHandler.android.js.map +1 -1
- package/lib/module/views/GestureHandler.ios.js +3 -1
- package/lib/module/views/GestureHandler.ios.js.map +1 -1
- package/lib/module/views/GestureHandler.js +6 -1
- package/lib/module/views/GestureHandler.js.map +1 -1
- package/lib/module/views/GestureHandler.kepler.js +4 -0
- package/lib/module/views/GestureHandler.kepler.js.map +1 -0
- package/lib/module/views/GestureHandlerNative.js +13 -9
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/Header/Header.js +12 -8
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +103 -93
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +43 -31
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/Screens.js +17 -9
- package/lib/module/views/Screens.js.map +1 -1
- package/lib/module/views/Stack/Card.js +313 -338
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardA11yWrapper.js +43 -0
- package/lib/module/views/Stack/CardA11yWrapper.js.map +1 -0
- package/lib/module/views/Stack/CardContainer.js +116 -90
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardContent.js +74 -0
- package/lib/module/views/Stack/CardContent.js.map +1 -0
- package/lib/module/views/Stack/CardStack.js +241 -180
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +80 -64
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts +8 -0
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts +3 -3
- package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +8 -0
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +10 -0
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +15 -7
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +84 -24
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/CardAnimationContext.d.ts +1 -2
- package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts +1 -2
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts +1 -2
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/conditional.d.ts +1 -1
- package/lib/typescript/src/utils/conditional.d.ts.map +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts.map +1 -1
- package/lib/typescript/src/utils/gestureActivationCriteria.d.ts +57 -0
- package/lib/typescript/src/utils/gestureActivationCriteria.d.ts.map +1 -0
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/src/utils/getShadowStyle.d.ts +27 -0
- package/lib/typescript/src/utils/getShadowStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/src/utils/useCardAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts.map +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +1 -1
- package/lib/typescript/src/views/GestureHandler.d.ts +3 -2
- package/lib/typescript/src/views/GestureHandler.d.ts.map +1 -1
- package/lib/typescript/src/views/GestureHandler.kepler.d.ts +2 -0
- package/lib/typescript/src/views/GestureHandler.kepler.d.ts.map +1 -0
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +4 -5
- package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/Header.d.ts +1 -2
- package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +4 -5
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts +2 -2
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/Screens.d.ts +7 -5
- package/lib/typescript/src/views/Screens.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts +14 -42
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts +15 -0
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts.map +1 -0
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +6 -8
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContent.d.ts +13 -0
- package/lib/typescript/src/views/Stack/CardContent.d.ts.map +1 -0
- package/lib/typescript/src/views/Stack/CardStack.d.ts +8 -7
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts +10 -81
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +72 -6
- package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +43 -25
- package/src/TransitionConfigs/TransitionPresets.tsx +35 -5
- package/src/TransitionConfigs/TransitionSpecs.tsx +30 -2
- package/src/index.tsx +12 -7
- package/src/navigators/createStackNavigator.tsx +47 -63
- package/src/types.tsx +116 -24
- package/src/utils/CardAnimationContext.tsx +3 -3
- package/src/utils/GestureHandlerRefContext.tsx +2 -2
- package/src/utils/ModalPresentationContext.tsx +1 -3
- package/src/utils/conditional.tsx +1 -1
- package/src/utils/findLastIndex.tsx +2 -5
- package/src/utils/gestureActivationCriteria.tsx +70 -0
- package/src/utils/getDistanceForDirection.tsx +5 -4
- package/src/utils/getInvertedMultiplier.tsx +5 -6
- package/src/utils/getModalRoutesKeys.ts +21 -0
- package/src/utils/getShadowStyle.tsx +37 -0
- package/src/utils/throttle.tsx +16 -0
- package/src/utils/useCardAnimation.tsx +2 -2
- package/src/utils/useGestureHandlerRef.tsx +3 -3
- package/src/utils/useKeyboardManager.tsx +5 -7
- package/src/views/GestureHandler.kepler.tsx +1 -0
- package/src/views/GestureHandler.tsx +2 -2
- package/src/views/GestureHandlerNative.tsx +5 -5
- package/src/views/Header/Header.tsx +8 -7
- package/src/views/Header/HeaderContainer.tsx +23 -18
- package/src/views/Header/HeaderSegment.tsx +41 -43
- package/src/views/Screens.tsx +4 -2
- package/src/views/Stack/Card.tsx +480 -462
- package/src/views/Stack/CardA11yWrapper.tsx +67 -0
- package/src/views/Stack/CardContainer.tsx +127 -108
- package/src/views/Stack/CardContent.tsx +92 -0
- package/src/views/Stack/CardStack.tsx +370 -243
- package/src/views/Stack/StackView.tsx +73 -62
- package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.bundle +0 -28538
- package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.map +0 -1
- package/SystemModules/amzn__react-navigation__stack-7.modules.txt +0 -95
- package/SystemModules/amzn__react-navigation__stack-7.private.modules.txt +0 -185
- package/THIRD_PARTY_NOTICES.txt +0 -24
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +0 -353
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +0 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +0 -259
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +0 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +0 -134
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +0 -1
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +0 -100
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +0 -1
- package/lib/commonjs/index.js +0 -69
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/navigators/createStackNavigator.js +0 -82
- package/lib/commonjs/navigators/createStackNavigator.js.map +0 -1
- package/lib/commonjs/types.js +0 -6
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/CardAnimationContext.js +0 -11
- package/lib/commonjs/utils/CardAnimationContext.js.map +0 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js +0 -11
- package/lib/commonjs/utils/GestureHandlerRefContext.js.map +0 -1
- package/lib/commonjs/utils/ModalPresentationContext.js +0 -12
- package/lib/commonjs/utils/ModalPresentationContext.js.map +0 -1
- package/lib/commonjs/utils/conditional.js +0 -32
- package/lib/commonjs/utils/conditional.js.map +0 -1
- package/lib/commonjs/utils/debounce.js +0 -19
- package/lib/commonjs/utils/debounce.js.map +0 -1
- package/lib/commonjs/utils/findLastIndex.js +0 -15
- package/lib/commonjs/utils/findLastIndex.js.map +0 -1
- package/lib/commonjs/utils/getDistanceForDirection.js +0 -20
- package/lib/commonjs/utils/getDistanceForDirection.js.map +0 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js +0 -20
- package/lib/commonjs/utils/getInvertedMultiplier.js.map +0 -1
- package/lib/commonjs/utils/memoize.js +0 -33
- package/lib/commonjs/utils/memoize.js.map +0 -1
- package/lib/commonjs/utils/useCardAnimation.js +0 -19
- package/lib/commonjs/utils/useCardAnimation.js.map +0 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +0 -19
- package/lib/commonjs/utils/useGestureHandlerRef.js.map +0 -1
- package/lib/commonjs/utils/useKeyboardManager.js +0 -96
- package/lib/commonjs/utils/useKeyboardManager.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.android.js +0 -17
- package/lib/commonjs/views/GestureHandler.android.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.ios.js +0 -17
- package/lib/commonjs/views/GestureHandler.ios.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.js +0 -24
- package/lib/commonjs/views/GestureHandler.js.map +0 -1
- package/lib/commonjs/views/GestureHandlerNative.js +0 -34
- package/lib/commonjs/views/GestureHandlerNative.js.map +0 -1
- package/lib/commonjs/views/Header/Header.js +0 -61
- package/lib/commonjs/views/Header/Header.js.map +0 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +0 -127
- package/lib/commonjs/views/Header/HeaderContainer.js.map +0 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +0 -139
- package/lib/commonjs/views/Header/HeaderSegment.js.map +0 -1
- package/lib/commonjs/views/ModalStatusBarManager.js +0 -42
- package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
- package/lib/commonjs/views/Screens.js +0 -44
- package/lib/commonjs/views/Screens.js.map +0 -1
- package/lib/commonjs/views/Stack/Card.js +0 -469
- package/lib/commonjs/views/Stack/Card.js.map +0 -1
- package/lib/commonjs/views/Stack/CardContainer.js +0 -259
- package/lib/commonjs/views/Stack/CardContainer.js.map +0 -1
- package/lib/commonjs/views/Stack/CardSheet.js +0 -54
- package/lib/commonjs/views/Stack/CardSheet.js.map +0 -1
- package/lib/commonjs/views/Stack/CardStack.js +0 -442
- package/lib/commonjs/views/Stack/CardStack.js.map +0 -1
- package/lib/commonjs/views/Stack/StackView.js +0 -333
- package/lib/commonjs/views/Stack/StackView.js.map +0 -1
- package/lib/module/utils/debounce.js.map +0 -1
- package/lib/module/utils/memoize.js +0 -27
- package/lib/module/utils/memoize.js.map +0 -1
- package/lib/module/views/ModalStatusBarManager.js +0 -34
- package/lib/module/views/ModalStatusBarManager.js.map +0 -1
- package/lib/module/views/Stack/CardSheet.js +0 -46
- package/lib/module/views/Stack/CardSheet.js.map +0 -1
- package/lib/typescript/src/utils/debounce.d.ts +0 -2
- package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
- package/lib/typescript/src/utils/memoize.d.ts +0 -2
- package/lib/typescript/src/utils/memoize.d.ts.map +0 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -12
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts +0 -15
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +0 -1
- package/src/utils/debounce.tsx +0 -17
- package/src/utils/memoize.tsx +0 -33
- package/src/views/ModalStatusBarManager.tsx +0 -50
- package/src/views/Stack/CardSheet.tsx +0 -61
|
@@ -1,203 +1,184 @@
|
|
|
1
|
-
|
|
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
|
|
6
|
-
import CardAnimationContext from
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
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
|
|
12
|
-
import
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
80
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
const spec =
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
132
|
+
forceUpdate();
|
|
138
133
|
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
onGestureBegin
|
|
162
|
+
isSwiping.setValue(TRUE);
|
|
163
|
+
onStartInteraction();
|
|
164
|
+
onGestureBegin?.();
|
|
185
165
|
break;
|
|
186
166
|
case GestureState.CANCELLED:
|
|
167
|
+
case GestureState.FAILED:
|
|
187
168
|
{
|
|
188
|
-
|
|
189
|
-
|
|
169
|
+
isSwiping.setValue(FALSE);
|
|
170
|
+
onEndInteraction();
|
|
190
171
|
const velocity = gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? nativeEvent.velocityY : nativeEvent.velocityX;
|
|
191
|
-
|
|
192
|
-
closing
|
|
172
|
+
animate({
|
|
173
|
+
closing,
|
|
193
174
|
velocity
|
|
194
175
|
});
|
|
195
|
-
onGestureCanceled
|
|
176
|
+
onGestureCanceled?.();
|
|
196
177
|
break;
|
|
197
178
|
}
|
|
198
179
|
case GestureState.END:
|
|
199
180
|
{
|
|
200
|
-
|
|
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
|
|
214
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
207
|
+
forceUpdate();
|
|
227
208
|
}, 32);
|
|
228
209
|
}
|
|
229
|
-
onGestureEnd
|
|
210
|
+
onGestureEnd?.();
|
|
230
211
|
break;
|
|
231
212
|
}
|
|
232
213
|
}
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
-
|
|
239
|
-
|
|
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:
|
|
248
|
-
swiping:
|
|
249
|
-
inverted
|
|
298
|
+
closing: isClosing,
|
|
299
|
+
swiping: isSwiping,
|
|
300
|
+
inverted,
|
|
250
301
|
layouts: {
|
|
251
302
|
screen: layout
|
|
252
303
|
},
|
|
253
304
|
insets: {
|
|
254
|
-
top:
|
|
255
|
-
right:
|
|
256
|
-
bottom:
|
|
257
|
-
left:
|
|
305
|
+
top: insets.top,
|
|
306
|
+
right: insets.right,
|
|
307
|
+
bottom: insets.bottom,
|
|
308
|
+
left: insets.left
|
|
258
309
|
}
|
|
259
|
-
}));
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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__*/
|
|
375
|
-
pointerEvents: "box-none"
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
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
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
|
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
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
398
|
+
...getShadowStyle({
|
|
399
|
+
offset: {
|
|
400
|
+
width: -1,
|
|
401
|
+
height: 1
|
|
402
|
+
},
|
|
403
|
+
radius: 5,
|
|
404
|
+
opacity: 0.3
|
|
405
|
+
})
|
|
435
406
|
},
|
|
436
|
-
|
|
437
|
-
|
|
407
|
+
shadowStart: {
|
|
408
|
+
start: 0
|
|
438
409
|
},
|
|
439
|
-
|
|
440
|
-
|
|
410
|
+
shadowEnd: {
|
|
411
|
+
end: 0
|
|
441
412
|
},
|
|
442
413
|
shadowVertical: {
|
|
443
|
-
|
|
444
|
-
|
|
414
|
+
start: 0,
|
|
415
|
+
end: 0,
|
|
445
416
|
height: 3,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
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
|