@momo-kits/foundation 0.150.2-beta.16 → 0.150.2-beta.18
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/Application/BottomSheet.tsx +1 -1
- package/Application/utils.tsx +2 -81
- package/package.json +1 -1
package/Application/utils.tsx
CHANGED
|
@@ -14,84 +14,9 @@ import { HeaderTitleProps, NavigationOptions } from './types';
|
|
|
14
14
|
import { Colors, Spacing } from '../Consts';
|
|
15
15
|
import { Animated, Platform } from 'react-native';
|
|
16
16
|
import { MiniAppContext, ScreenContext, TrackingScopeContext } from './index';
|
|
17
|
-
import { Easing } from 'react-native-reanimated';
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
const customTransitionSpec = {
|
|
23
|
-
open: {
|
|
24
|
-
animation: 'timing' as const,
|
|
25
|
-
config: {
|
|
26
|
-
duration: 300,
|
|
27
|
-
easing: Easing.out(Easing.cubic),
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
close: {
|
|
31
|
-
animation: 'timing' as const,
|
|
32
|
-
config: {
|
|
33
|
-
duration: 250,
|
|
34
|
-
easing: Easing.in(Easing.cubic),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const customSpringTransitionSpec = {
|
|
40
|
-
open: {
|
|
41
|
-
animation: 'spring' as const,
|
|
42
|
-
config: {
|
|
43
|
-
damping: 30,
|
|
44
|
-
mass: 1,
|
|
45
|
-
stiffness: 300,
|
|
46
|
-
overshootClamping: false,
|
|
47
|
-
restDisplacementThreshold: 0.01,
|
|
48
|
-
restSpeedThreshold: 0.01,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
close: {
|
|
52
|
-
animation: 'spring' as const,
|
|
53
|
-
config: {
|
|
54
|
-
damping: 35,
|
|
55
|
-
mass: 1,
|
|
56
|
-
stiffness: 400,
|
|
57
|
-
overshootClamping: false,
|
|
58
|
-
restDisplacementThreshold: 0.01,
|
|
59
|
-
restSpeedThreshold: 0.01,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Custom slide from right interpolator
|
|
66
|
-
*/
|
|
67
|
-
const slideFromRightInterpolator = ({
|
|
68
|
-
current,
|
|
69
|
-
_next,
|
|
70
|
-
inverted,
|
|
71
|
-
layouts: { screen },
|
|
72
|
-
}: any) => {
|
|
73
|
-
const progress = current.progress.interpolate({
|
|
74
|
-
inputRange: [0, 1],
|
|
75
|
-
outputRange: [0, 1],
|
|
76
|
-
extrapolate: 'clamp',
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
cardStyle: {
|
|
81
|
-
transform: [
|
|
82
|
-
{
|
|
83
|
-
translateX: progress.interpolate({
|
|
84
|
-
inputRange: [0, 1],
|
|
85
|
-
outputRange: inverted ? [screen.width, 0] : [-screen.width, 0],
|
|
86
|
-
}),
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* default options for stack screen with reanimated transitions
|
|
19
|
+
* default options for stack screen
|
|
95
20
|
*/
|
|
96
21
|
const getStackOptions = (): StackNavigationOptions => {
|
|
97
22
|
return {
|
|
@@ -111,11 +36,7 @@ const getStackOptions = (): StackNavigationOptions => {
|
|
|
111
36
|
headerRight: (props: any) => <HeaderRight {...props} />,
|
|
112
37
|
headerTintColor: Colors.black_17,
|
|
113
38
|
gestureEnabled: false,
|
|
114
|
-
|
|
115
|
-
open: customTransitionSpec.open,
|
|
116
|
-
close: customTransitionSpec.close,
|
|
117
|
-
},
|
|
118
|
-
cardStyleInterpolator: slideFromRightInterpolator,
|
|
39
|
+
...TransitionPresets.SlideFromRightIOS,
|
|
119
40
|
};
|
|
120
41
|
};
|
|
121
42
|
|