-
Notifications
You must be signed in to change notification settings - Fork 22
/
App.js
33 lines (28 loc) · 1 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
import React from 'react';
import { StackNavigator, NavigationActions } from 'react-navigation';
import WelcomeView from './containers/WelcomeView';
import LoginView from './containers/LoginView';
import HomeView from './containers/HomeView';
import GameView from './containers/GameView';
import RegistrationView from './containers/RegistrationView';
const App = StackNavigator({
WelcomeView: {screen: WelcomeView},
LoginView: {screen: LoginView},
HomeView: {screen: HomeView},
GameView: {screen: GameView},
RegistrationView: {screen: RegistrationView}
},
{
initialRouteName: 'WelcomeView',
headerMode: 'none'
});
const navigateOnce = (getStateForAction) => (action, state) => {
const {type, routeName} = action;
return (
state &&
type === NavigationActions.NAVIGATE &&
routeName === state.routes[state.routes.length - 1].routeName
) ? null : getStateForAction(action, state);
};
App.router.getStateForAction = navigateOnce(App.router.getStateForAction);
export default App;