Created
July 12, 2019 14:31
-
-
Save anastely/7f4997fb1f77c80f65c701c8347aa64d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here The Root Route for whole app | |
import React, { Component } from "react"; | |
import { View, TouchableOpacity } from "react-native"; | |
import { | |
createDrawerNavigator, | |
createStackNavigator, | |
createAppContainer, | |
DrawerActions, | |
createSwitchNavigator | |
} from "react-navigation"; | |
import Icon from "react-native-vector-icons/Ionicons"; | |
// Screens | |
import SignIn from "../screens/SignIn"; | |
import SignUp from "../screens/signup"; | |
import Home from "../screens/Home"; | |
import Splash from "../screens/Splash"; | |
import Profile from "../screens/Profile"; | |
// import AcceptedOrders from "../screens/AcceptedOrders"; | |
import Orders from "../screens/Orders"; | |
import OrderDetails from "../screens/OrderDetails"; | |
const AuthStackNavigator = createStackNavigator({ | |
Splash: { | |
screen: Splash, | |
navigationOptions: { | |
header: null | |
} | |
}, | |
SignIn: { | |
screen: SignIn, | |
navigationOptions: () => ({ | |
// header: null | |
title: "Sign In", | |
headerLeft: null, | |
headerTintColor: "#2F98AE", | |
headerStyle: { | |
borderBottomColor: "white" | |
}, | |
headerTitleStyle: { | |
color: "#2F98AE", | |
// textAlign: "center", | |
flex: 1, | |
elevation: 0, | |
fontSize: 25 | |
// justifyContent: "center" | |
} | |
}) | |
}, | |
SignUp: { | |
screen: SignUp, | |
navigationOptions: () => ({ | |
// header: null | |
title: "Sign Up", | |
headerLeft: null, | |
headerTintColor: "#2F98AE", | |
headerStyle: { | |
borderBottomColor: "white" | |
}, | |
headerTitleStyle: { | |
color: "#2F98AE " | |
// textAlign: "center", | |
} | |
}) | |
} | |
}); | |
const HomeStack = createStackNavigator({ | |
Home: { | |
screen: Home, | |
navigationOptions: ({ navigation }) => ({ | |
// headerLeft: <NavigationDrawerStructure navigationProps={navigation} />, | |
title: "Home", | |
headerRight: <View />, | |
headerLeft: ( | |
// <TouchableOpacity onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}> | |
<TouchableOpacity | |
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())} | |
> | |
<Icon | |
name="ios-menu" | |
size={40} | |
style={{ margin: 10 }} | |
color="#2F98AE" | |
/> | |
</TouchableOpacity> | |
), | |
// headerLeft: <NavigationDrawerStructure navigationProps={navigation} />, | |
headerTintColor: "#2F98AE", | |
headerStyle: { | |
borderBottomColor: "white" | |
}, | |
headerTitleStyle: { | |
color: "#2F98AE", | |
// textAlign: "center", | |
flex: 1, | |
elevation: 0, | |
fontSize: 25 | |
// justifyContent: "center" | |
} | |
}) | |
} | |
}); | |
const ProfileStack = createStackNavigator({ | |
Profile: { | |
screen: Profile, | |
navigationOptions: ({ navigation }) => ({ | |
headerLeft: ( | |
// <TouchableOpacity onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}> | |
<TouchableOpacity | |
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())} | |
> | |
<Icon | |
name="ios-menu" | |
size={40} | |
style={{ margin: 10 }} | |
color="#2F98AE" | |
/> | |
</TouchableOpacity> | |
), | |
headerRight: <View />, | |
title: "Profile", | |
headerTintColor: "#2F98AE", | |
headerStyle: { | |
borderBottomColor: "white" | |
}, | |
headerTitleStyle: { | |
color: "#2F98AE", | |
// textAlign: "center", | |
flex: 1, | |
elevation: 0, | |
fontSize: 25 | |
// justifyContent: "center" | |
} | |
}) | |
} | |
}); | |
const OrdersStack = createStackNavigator({ | |
Orders: { | |
screen: Orders, | |
navigationOptions: ({ navigation }) => ({ | |
headerLeft: ( | |
// <TouchableOpacity onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())}> | |
<TouchableOpacity | |
onPress={() => navigation.dispatch(DrawerActions.toggleDrawer())} | |
> | |
<Icon | |
name="ios-menu" | |
size={40} | |
style={{ margin: 10 }} | |
color="#2F98AE" | |
/> | |
</TouchableOpacity> | |
), | |
headerRight: <View />, | |
title: "My Orders", | |
headerTintColor: "#2F98AE", | |
headerStyle: { | |
borderBottomColor: "white" | |
}, | |
headerTitleStyle: { | |
color: "#2F98AE", | |
// textAlign: "center", | |
flex: 1, | |
elevation: 0, | |
fontSize: 25 | |
// justifyContent: "center" | |
} | |
}) | |
} | |
// OrderDetails: { | |
// screen: OrderDetails, | |
// navigationOptions: () => ({ | |
// title: "Order Details", | |
// headerRight: <View />, | |
// headerTintColor: "#2F98AE", | |
// headerStyle: { | |
// borderBottomColor: "white" | |
// }, | |
// headerTitleStyle: { | |
// color: "#2F98AE", | |
// flex: 1, | |
// elevation: 0, | |
// fontSize: 25, | |
// } | |
// }) | |
// }, | |
}); | |
const DrawerNavigator = createDrawerNavigator({ | |
HomeStack: { | |
screen: HomeStack, | |
navigationOptions: { | |
drawerLabel: "Home", | |
drawerIcon: () => <Icon name="ios-home" size={25} color="#2F98AE" /> | |
} | |
}, | |
OrdersStack: { | |
screen: OrdersStack, | |
navigationOptions: { | |
drawerLabel: "My Orders", | |
drawerIcon: () => <Icon name="ios-paper" size={25} color="#2F98AE" /> | |
} | |
}, | |
// AcceptedOrdersStack: { | |
// screen: AcceptedOrdersStack, | |
// navigationOptions: { | |
// drawerLabel: 'My Orders', | |
// drawerIcon: () => <Icon name="ios-paper" size={25} color="#2F98AE" />, | |
// }, | |
// }, | |
ProfileStack: { | |
screen: ProfileStack, | |
navigationOptions: { | |
drawerLabel: "Profile", | |
drawerIcon: () => <Icon name="ios-contact" size={27} color="#2F98AE" /> | |
} | |
} | |
}); | |
const Navigations = createSwitchNavigator({ | |
Authloading: Splash, | |
Auth: AuthStackNavigator, // the Auth stack | |
App: DrawerNavigator // the App stack | |
}); | |
export default (MyApp = createAppContainer(Navigations)); | |
// export default MyApp = createAppContainer(AuthStackNavigator); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment