This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathApp.js
61 lines (55 loc) · 1.68 KB
/
App.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
import { createStackNavigator, createAppContainer } from 'react-navigation';
import { Easing, Animated } from 'react-native';
import HomeScreen from './src/screens/HomeScreen';
import TripsScreen from './src/screens/TripsScreen';
import TripDetailScreen from './src/screens/TripDetailScreen';
import AddTripScreen from './src/screens/AddTripScreen';
import AddPointScreen from './src/screens/AddPointScreen';
import ModalScreen from './src/screens/ModalScreen';
const contentNavigator = createStackNavigator(
{
Home: HomeScreen,
Trips: TripsScreen,
TripDetail: TripDetailScreen,
AddTrip: AddTripScreen,
AddPoint: AddPointScreen
},
{ initialRouteName: 'Home' }
);
export const AppNavigator = createStackNavigator(
{
content: contentNavigator,
modal: { screen: ModalScreen }
},
{
headerMode: 'none',
mode: 'modal',
initialRouteName: 'content',
animationEnabled: false,
swipeEnabled: false,
transparentCard: true,
transitionConfig: () => ({
transitionSpec: {
duration: 750,
easing: Easing.out(Easing.poly(4)),
timing: Animated.timing,
useNativeDriver: true
},
screenInterpolator: sceneProps => {
const { layout, position, scene } = sceneProps;
const thisSceneIndex = scene.index;
const height = layout.initHeight;
const translateY = position.interpolate({
inputRange: [thisSceneIndex - 1, thisSceneIndex, thisSceneIndex + 1],
outputRange: [height, 0, 0]
});
const opacity = position.interpolate({
inputRange: [thisSceneIndex - 1, thisSceneIndex, thisSceneIndex + 1],
outputRange: [1, 1, 0.5]
});
return { opacity, transform: [{ translateY }] };
}
})
}
);
export default createAppContainer(AppNavigator);