Tell us which versions you are using:
Hey guys,
I'm trying to figure out how to dynamically set my initial scene on startup depending on my auth state. Ive tried the following but it does not work:
//render method
render () {
let authenticated = this.props.isAuthenticated
return (
<Router>
<Scene key='drawer' component={NavigationDrawer} open={false} unmountScenes>
<Scene key='drawerChildrenWrapper' navigationBarStyle={Styles.navBar} titleStyle={Styles.title} leftButtonIconStyle={Styles.leftButton} rightButtonTextStyle={Styles.rightButton} >
<Scene key='berries' initial={authenticated} component={BerriesTabs} hideNavBar />
<Scene key='login' initial={!authenticated} direction="vertical" panHandlers={null} component={LoginScreen} title='Login' hideNavBar />
</Scene>
</Scene>
</Router>
)
}
//redux connect
const select = (state: Object) => {
return {
isAuthenticated: state.auth.isAuthenticated
}
}
export default connect(select,null)(NavigationRouter)
Unfortunately, this does't seem to work. Before that, I tried to get Switch to work, which caused the error message can't find variable: Switch.
Best,
D
The way I've handled this is by always starting on a custom SplashScreen screen and have it trigger something on componentDidMount
can I render tabs or scene depending upon user type. i.e. if seller logs in I want to show different set of routes / tabs and if a customer logs in than different set of tabs.
Most helpful comment
The way I've handled this is by always starting on a custom
SplashScreenscreen and have it trigger something oncomponentDidMount