Created
January 14, 2019 03:10
-
-
Save aloukissas/beaed40353e11bc891efade575b50c3c 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
import React from "react"; | |
import { | |
createStackNavigator, | |
createBottomTabNavigator, | |
createSwitchNavigator | |
} from "react-navigation"; | |
import Signup from "./screens/Signup"; | |
import Login from "./screens/Login"; | |
import Home from "./screens/Home"; | |
import Profile from "./screens/Profile"; | |
export const Unauthenticated = createStackNavigator({ | |
Signup: { | |
screen: Signup, | |
navigationOptions: { | |
title: "Sign up" | |
} | |
}, | |
Login: { | |
screen: Login, | |
navigationOptions: { | |
title: "Login" | |
} | |
} | |
}); | |
export const Authenticated = createBottomTabNavigator({ | |
Home: { | |
screen: Home, | |
navigationOptions: { | |
title: "Home" | |
} | |
}, | |
Profile: { | |
screen: Profile, | |
navigationOptions: { | |
title: "Profile" | |
} | |
} | |
}); | |
export const createRootNavigator = isAuthenticated => { | |
return createSwitchNavigator( | |
{ | |
Authenticated: { | |
screen: Authenticated | |
}, | |
Unauthenticated: { | |
screen: Unauthenticated | |
} | |
}, | |
{ | |
initialRouteName: isAuthenticated ? "Authenticated" : "Unauthenticated" | |
} | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment