navigationUtil.js
1.13 KB
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
export const fromBottom = (props) => {
const {layout, position, scene} = props;
const index = scene.index;
const height = layout.initHeight;
const translateX = 0;
const translateY = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [height, 0, 0],
});
return {
transform: [{translateX}, {translateY}]
};
}
export const fromBottomLikeAndroid = (props) => {
const {layout, position, scene} = props;
const index = scene.index;
const inputRange = [index - 1, index, index + 0.9, index + 1];
const opacity = position.interpolate({
inputRange,
outputRange: [0, 1, 0.7, 0.8],
});
const translateX = 0;
const translateY = position.interpolate({
inputRange,
outputRange: [50, 0, 0, 0],
});
return {
opacity,
transform: [{translateX}, {translateY}]
};
}
export const fromRight= (props) => {
const {layout, position, scene} = props;
const index = scene.index;
const width = layout.initWidth;
const translateX = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [width, 0, 0],
});;
const translateY = 0
return {
transform: [{translateX}, {translateY}]
};
}