【发布时间】:2016-07-20 19:42:23
【问题描述】:
以下是更新后的代码——我正在尝试从https://github.com/root-two/react-native-drawer 实现 react-native-drawer,并且我传递给 NavigationBarRouteMapper 的变量正确记录了 openDrawer() 函数,但是当单击左侧导航按钮时它什么也不做:
class practice 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>
)
}
},...
什么可能阻止抽屉打开?似乎一切都已正确实施。
【问题讨论】:
-
@NaderDabit 仍然卡住
标签: javascript ios react-native react-jsx