Using react-native-drawer ( https://github.com/root-two/react-native-drawer ) in my index.ios.js, I have the following set up and trying to pass \'navigator\' reference into con
This is how it should be done. You save the navigator reference form renderScene
method define a getter method, pass the method to the component you want.
class practice extends Component {
...
renderScene(route, navigator){
this._navigator = navigator
}
configureScene(route, routeStack){
...
}
getNav = () => {
return this._navigator
}
render() {
return (
<Drawer
content={<DrawerPanel getNav={this.getNav}/>}
...
>
<Navigator
configureScene={this.configureScene}
initialRoute={{name: 'Login', component: Login}}
renderScene={(route, navigator) => this.renderScene(route, navigator)}
style={styles.container}
navigationBar={
<Navigator.NavigationBar
style={styles.navBar}
routeMapper={NavigationBarRouteMapper(this.openDrawer)}
/>
}
/>
</Drawer>
);
}
}
I think you are wrong. If you use , should not has the same parent node with .
const Drawer = <Drawer
content={<DrawerPanel navigator={navigator}/>}
...
/>
<Navigator
initialRoute={{ name: 'Drawer', component: Drawer }}
renderScene={(route, navigator) =>
configureScene={(route) => {
return Navigator.SceneConfigs.VerticalDownSwipeJump;
}}
renderScene={(route, navigator) => {
let Component = route.component;
return <Component {...route.params} navigator={navigator} />
}} />
}
/>
In update 2, you have done: var navigator = pr.getNav
. This only assigns getNav function to the navigator variable you just defined. So your navigator here is just a reference to the getNav function.
What you need to do is var navigator = pr.getNav()
and then pass the navigator to MadeButton
. Hope is clarify things.