Hide navigator in React Native? -
i'm developing first application in react native , have run first problem. navigation i'm using navigator. problem hide on app's login page, don't know how it.
here navigator index.ios.js:
class testapp extends component { renderscene(route, navigator) { switch (route.name) { case 'home': return (<home navigator={navigator} />) case 'login': return (<login navigator={navigator} />) } } render() { return ( <navigator initialroute={{name: 'login'}} renderscene={this.renderscene} configurescene={() => navigator.sceneconfigs.floatfrombottomandroid} navigationbar={ <navigator.navigationbar routemapper={navigationbarroutemapper} style = {styles.navigationbar} /> } /> ); } }
is there way hide navigator page?
so managed solve myself moving navigator own component following class:
class navigationbar extends navigator.navigationbar { render() { var routes = this.props.navstate.routestack; if(routes.length){ var route = routes[routes.length -1]; } if (!route.display) { return null; } return super.render(); } }
in index set display true, except login set false:
route.display = true; switch (route.name) { case 'home': return (<home navigator={navigator} />) case 'login': route.display = false; return (<login navigator={navigator} />) }
probably not best solution since variable set true or false each time view rendered. works.
Comments
Post a Comment