Skip to content

Instantly share code, notes, and snippets.

@bfagundez
Last active March 24, 2016 18:08
Show Gist options
  • Save bfagundez/8061c16ca76231431408 to your computer and use it in GitHub Desktop.
Save bfagundez/8061c16ca76231431408 to your computer and use it in GitHub Desktop.
react native routing with navigator
import HomePage from './app/components/anonymous/home/homepage'
import SignUp from './app/components/anonymous/signup/signup'
import Market from './app/components/authenticated/market/market'
import Shop from './app/components/authenticated/market/shop/shop'
class PackShop extends Component {
render() {
return (
<Navigator
style={{ flex:1 }}
initialRoute={{ name: 'Shop' }}
renderScene={ this.renderScene }
/>
);
}
renderScene(route,nav) {
console.log('returning this crap, render scene',route,nav)
switch (route.name) {
case "HomePage":
return <HomePage navigator={nav} ></HomePage>
case "SignUp":
return <SignUp navigator={nav} ></SignUp>
case "Market":
return <Market navigator={nav} ></Market>
default:
case "Shop":
return <Shop navigator={nav} ></Shop>
default:
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment