-
Notifications
You must be signed in to change notification settings - Fork 13
/
sceneConfig.js
101 lines (90 loc) · 1.86 KB
/
sceneConfig.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import buildStyleInterpolator from 'react-native/Libraries/Utilities/buildStyleInterpolator';
import {
PixelRatio,
Dimensions,
Platform,
} from 'react-native';
// eslint-disable-next-line
import FBNavigator from './FBNavigator';
let sceneConfig = FBNavigator.SceneConfigs.PushFromRight;
const outAnimation = {
transformTranslate: {
from: { x: 0, y: 0, z: 0 },
to: { x: -Math.round(Dimensions.get('window').width * 0.3), y: 0, z: 0 },
min: 0,
max: 1,
type: 'linear',
extrapolate: true,
round: PixelRatio.get(),
},
transformScale: {
value: { x: 1, y: 1, z: 1 },
type: 'constant',
},
opacity: {
value: 1.0,
type: 'constant',
},
translateX: {
from: 0,
to: -Math.round(Dimensions.get('window').width * 0.3),
min: 0,
max: 1,
type: 'linear',
extrapolate: true,
round: PixelRatio.get(),
},
scaleX: {
value: 1,
type: 'constant',
},
scaleY: {
value: 1,
type: 'constant',
},
};
const intoAnimation = {
opacity: {
value: 1.0,
type: 'constant',
},
transformTranslate: {
from: { x: Dimensions.get('window').width, y: 0, z: 0 },
to: { x: 0, y: 0, z: 0 },
min: 0,
max: 1,
type: 'linear',
extrapolate: true,
round: PixelRatio.get(),
},
translateX: {
from: Dimensions.get('window').width,
to: 0,
min: 0,
max: 1,
type: 'linear',
extrapolate: true,
round: PixelRatio.get(),
},
scaleX: {
value: 1,
type: 'constant',
},
scaleY: {
value: 1,
type: 'constant',
},
};
const CustomPushFromRight = {
...sceneConfig,
animationInterpolators: {
out: buildStyleInterpolator(outAnimation),
into: buildStyleInterpolator(intoAnimation),
},
};
export {
CustomPushFromRight,
};
export default sceneConfig = Platform.OS === 'ios' ?
CustomPushFromRight :
FBNavigator.SceneConfigs.FadeAndroid;