Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created September 11, 2017 18:18
Show Gist options
  • Save diego3g/3378c3c17bbcd20982c2793e2c52eb9e to your computer and use it in GitHub Desktop.
Save diego3g/3378c3c17bbcd20982c2793e2c52eb9e to your computer and use it in GitHub Desktop.
// src/routes.js
import { StackNavigator } from 'react-navigation';
import Login from './pages/login';
import Logged from './pages/logged';
export const SignedOutRoutes = StackNavigator({
Login: {
screen: Login,
navigationOptions: {
title: "Entrar"
}
},
});
export const SignedInRoutes = StackNavigator({
Logged: {
screen: Logged,
navigationOptions: {
title: "Meu perfil"
}
},
});
export const createRootNavigator = (signedIn = false) => {
return StackNavigator({
SignedIn: { screen: SignedInRoutes },
SignedOut: { screen: SignedOutRoutes }
},
{
headerMode: "none",
mode: "modal",
initialRouteName: signedIn ? "SignedIn" : "SignedOut",
navigationOptions: {
gesturesEnabled: false
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment