i’m using react native drawer of https://github.com/root-two/react-native-drawer
i trying call method opendrawer() passing in variable navigationbarroutemapper. tried logging inside navigationbarroutemapper, , logs variable passed in correctly. when used inside navigationbarroutemapper, clicking left navigation button of ‘open drawer’, not anything:
class drawerpractice extends component { ... opendrawer(){ this._drawer.open() } render() { return ( <drawer content={<drawerpanel/>} opendraweroffset={100} ref={(ref) => this._drawer = ref} type='static' tweenhandler={drawer.tweenpresets.parallax} > <navigator configurescene={this.configurescene} initialroute={{name: 'start', component: start}} renderscene={this.renderscene} style={styles.container} navigationbar={ <navigator.navigationbar style={styles.navbar} routemapper={navigationbarroutemapper(this.opendrawer)} /> } /> </drawer> ); } } var navigationbarroutemapper = opendrawer => ({ leftbutton(route, navigator, index, navstate){ return( <touchablehighlight onpress={()=>{opendrawer}}> <text>open menu</text> </touchablehighlight> ) } },...
why may issue?
on constructor()
method add this: this.opendrawer = this.opendrawer.bind(this);
you're using this
on wrong scope.
Comments
Post a Comment