Hi
im have 2 costum tabs for user & admin. so after user login, the router flux will display tabs by catagory. im try to put if else in my root scene, but no work.
class RootRouter extends React.Component{
constructor(props){
super(props)
this.state = {
userId : '',
userStatus:''
}
}
componentDidMount () {
AsyncStorage.getItem("status")
.then(res => JSON.parse(res))
.then(data => this.setState({
userStatus : data
}))
.catch(err => console.log(err))
}
render () {
return (
<Router>
<Scene key="root">
<Scene key="login" component={Login} hideNavBar />
{
this.state.userStatus === 0
// IF ADMIN LOGIN
? (
<Scene
key="main"
tabs={true}
tabBarPosition="bottom"
swipeEnabled
showLabel={false}
activeBackgroundColor="white"
inactiveBackgroundColor="#251a34"
tabBarStyle={{ backgroundColor: '#eee' }}
>
<Scene key="tab_feed" title="Home" iconName="home" icon={TabIcon} component={Home} initial hideNavBar />
</Scene>
)
// IF USER LOGIN
: (
<Scene
key="main"
tabs={true}
tabBarPosition="bottom"
swipeEnabled
showLabel={false}
activeBackgroundColor="white"
inactiveBackgroundColor="#251a34"
tabBarStyle={{ backgroundColor: '#eee' }}
>
<Scene key="tab_feed" title="Home" iconName="home" icon={TabIcon} component={Home} initial hideNavBar />
<Scene key="tab_search" title="Search" iconName="search" icon={TabIcon} hideNavBar component={SearchEvent}
/>
</Scene>
)
}
</Scene>
</Router>
);
}
}
export default RootRouter;
im try to refresh root screne with Actions.tab_feed({refresh: true}) , but still not work.
Please anyone idea to solve this? Thanks
Hi
im have 2 costum tabs for user & admin. so after user login, the router flux will display tabs by catagory. im try to put if else in my root scene, but no work.
im try to refresh root screne with Actions.tab_feed({refresh: true}) , but still not work.
Please anyone idea to solve this? Thanks