-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathRoot.js
More file actions
74 lines (65 loc) · 1.56 KB
/
Root.js
File metadata and controls
74 lines (65 loc) · 1.56 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import React from "react";
import { Animated, Easing } from "react-native";
import { createStackNavigator } from "react-navigation";
import MainScreen from "./src/screens/Main";
import ShareScreen from "./src/screens/Share";
import DetailsScreen from "./src/screens/Details";
import TrashScreen from "./src/screens/Trash";
const transitionConfig = () => {
return {
transitionSpec: {
duration: 300,
easing: Easing.bounce,
timing: Animated.timing,
useNativeDriver: true
},
screenInterpolator: sceneProps => {
const { layout, position, scene } = sceneProps;
const thisSceneIndex = scene.index;
const width = layout.initWidth;
const translateX = position.interpolate({
inputRange: [thisSceneIndex - 1, thisSceneIndex],
outputRange: [width, 0],
extrapolate: "clamp"
});
const opacity = position.interpolate({
inputRange: [thisSceneIndex - 1, thisSceneIndex - 0.5, thisSceneIndex],
outputRange: [0, 0.2, 1],
extrapolate: "clamp"
});
return { opacity, transform: [{ translateX }] };
}
};
};
const MainStack = createStackNavigator(
{
Main: {
screen: MainScreen
},
Share: {
screen: ShareScreen
},
Trash: {
screen: TrashScreen
}
},
{
initialRouteName: "Main",
transitionConfig
}
);
const RootStack = createStackNavigator(
{
Main: {
screen: MainStack
},
Details: {
screen: DetailsScreen
}
},
{
mode: "modal",
headerMode: "none"
}
);
export default RootStack;