|
import React from 'react' |
|
import { Text, Animated, Easing } from 'react-native' |
|
import { StackNavigator, DrawerNavigator } from 'react-navigation' |
|
import LoginScreen from '../Containers/LoginScreen' |
|
import SignupScreen from '../Containers/SignupScreen' |
|
import ForgottenPasswordScreen from '../Containers/ForgottenPasswordScreen' |
|
import Screen1 from '../Containers/Screen1' |
|
import Screen2 from '../Containers/Screen2' |
|
import Screen3 from '../Containers/Screen3' |
|
|
|
// https://github.com/react-community/react-navigation/issues/1254 |
|
const noTransitionConfig = () => ({ |
|
transitionSpec: { |
|
duration: 0, |
|
timing: Animated.timing, |
|
easing: Easing.step0 |
|
} |
|
}) |
|
|
|
// drawer stack |
|
const DrawerStack = DrawerNavigator({ |
|
screen1: { screen: Screen1 }, |
|
screen2: { screen: Screen2 }, |
|
screen3: { screen: Screen3 }, |
|
}, { |
|
gesturesEnabled: false |
|
}) |
|
|
|
const DrawerNavigation = StackNavigator({ |
|
DrawerStack: { screen: DrawerStack } |
|
}, { |
|
headerMode: 'float', |
|
navigationOptions: ({navigation}) => ({ |
|
headerStyle: {backgroundColor: 'green'}, |
|
title: 'Logged In to your app!', |
|
gesturesEnabled: false, |
|
headerLeft: <Text onPress={() => { |
|
// Coming soon: navigation.navigate('DrawerToggle') |
|
// https://github.com/react-community/react-navigation/pull/2492 |
|
if (navigation.state.index === 0) { |
|
navigation.navigate('DrawerOpen') |
|
} else { |
|
navigation.navigate('DrawerClose') |
|
} |
|
}}>Menu</Text> |
|
}) |
|
}) |
|
|
|
// login stack |
|
const LoginStack = StackNavigator({ |
|
loginScreen: { screen: LoginScreen }, |
|
signupScreen: { screen: SignupScreen }, |
|
forgottenPasswordScreen: { screen: ForgottenPasswordScreen, navigationOptions: { title: 'Forgot Password' } } |
|
}, { |
|
headerMode: 'float', |
|
navigationOptions: { |
|
headerStyle: {backgroundColor: 'red'}, |
|
title: 'You are not logged in' |
|
} |
|
}) |
|
|
|
// Manifest of possible screens |
|
const PrimaryNav = StackNavigator({ |
|
loginStack: { screen: LoginStack }, |
|
drawerStack: { screen: DrawerNavigation } |
|
}, { |
|
// Default config for all screens |
|
headerMode: 'none', |
|
title: 'Main', |
|
initialRouteName: 'loginStack', |
|
transitionConfig: noTransitionConfig |
|
}) |
|
|
|
export default PrimaryNav |