如何重新打开react-native中的side-menu

时间:2015-10-14 06:24:44

标签: react-native

native-side-menu ,,,在我的menu.js文件中,当我点击文本侧面菜单关闭和新组件要显示时,那部分我的代码工作,但我的问题是,当我按下按钮侧菜单再次重新打开我的代码不工作,我在那里挣扎 这是我的代码是这样的:

Place(){
    this.props.getNavigator().push({
      component:Place,
      title:’ Place',
      leftButtonIcon: require('image!settings3'),
      onLeftButtonPress: ()=> {this.refs.sidemenu.openMenu()},//here i am getting confusion that how to reopen my sidemenu//
    });
}
render(){
return(
<ScrollView>
<TouchableOpacity getNavigator={this.props.getNavigator} onPress={this.Place.bind(this)}>
                      <Image style={styles.avatar} source={require('image!location')}/>
                      <Text style={styles.name}>Place</Text>
               </TouchableOpacity>
</ScrollView>
)
}

我想要的是当我再次按下leftButtonIcon时,我想重新打开侧边菜单,任何帮助必须得到赞赏

1 个答案:

答案 0 :(得分:0)

在原生端菜单中,我们必须使用menuActions来控制侧边菜单 在这种情况下使用this.context.menuActions.open()

您可以查看https://github.com/Kureev/react-native-side-menu#managing-menu-state 有关menuActions的详细文档