-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
55 lines (49 loc) · 1.46 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
import {AppRegistry, Platform, StatusBar} from 'react-native';
import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from "react-navigation-stack";
import {fromRight, fromTop, fromLeft, zoomIn} from 'react-navigation-transitions';
// screens
import Map from "./screens/Map";
import Info from "./screens/Info";
import Picture from "./screens/Picture";
// custom animation transitions
const handleCustomTransition = ({ scenes }) => {
const prevScene = scenes[scenes.length - 2];
const nextScene = scenes[scenes.length - 1];
if(prevScene &&
prevScene.route.routeName == "Map"
&& nextScene.route.routeName == "Info") {
return fromRight();
}
if(prevScene &&
prevScene.route.routeName == "Map"
&& nextScene.route.routeName == "Picture") {
return fromRight();
}
// by default, open the page from the left
return fromLeft();
}
// create the stackNavigator that holds all the pages (Intents)
const Navigation = createStackNavigator({
Map: {
screen: Map
},
Info: {
screen: Info
},
Picture: {
screen: Picture
}
}, {
// default navigation options
defaultNavigationOptions: {
header: null
},
// transition animations to other pages
transitionConfig: (nav) => handleCustomTransition(nav)
});
// export the App class as an app container
const App = createAppContainer(Navigation);
export default App;
// disable yellow Expo warning boxes
console.disableYellowBox = true;