[英]How to use TouchableOpacity onPress in side menu?
How to implement active links to other pages in side menu? 如何在侧面菜单中实现到其他页面的有效链接?
I'm using this example https://github.com/react-native-fellowship/react-native-side-menu/tree/master/examples/Basic on my app, but when I added TouchableOpacity
with onPress
function 我在我的应用程序上使用此示例https://github.com/react-native-fellowship/react-native-side-menu/tree/master/examples/Basic ,但是当我通过onPress
函数添加TouchableOpacity
时
this.props.navigator.push({
name: 'Main'
});
I had an error "Cannot read property 'push' of undefined". 我遇到了一个错误“无法读取未定义的属性'push'”。 And all functions execute when side menu opened (before I press the buttons). 当打开侧面菜单时(在我按下按钮之前),所有功能都会执行。 How to fix it? 如何解决?
I had an error "Cannot read property 'push' of undefined". 我遇到了一个错误“无法读取未定义的属性'push'”。
You need to use 您需要使用
<Menu navigator={this.props.navigator}/>
instead of 代替
<Menu/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.