trying to have display the landing page screen in react native instead of the login page if the user is already logged in. I am using a stack navigator, and I don't know how to set the initialrouteName based on whether or not the user is logged in.
...
const Navigator = StackNavigator({
login: {screen: login},
landingPage: {screen: landingPage},
,{ initialRouteName: ???? }
class initial extends Component {
render() {
return(<Navigator /> );
}
}
I want to maybe use state in the class or something to check if the user is loaded using the firebase.auth.onAuthChanged((user)=> ...} method, but I don't know how to set the initialRouteName outside of the class to change on whether or not the user is logged in