【发布时间】:2019-02-08 15:13:30
【问题描述】:
我使用 const 来显示组件。现在,当我对 const 中的按钮使用反应导航时,我看到了这个错误:undefined is not an object (evalating '_this.props.navigation.navigate')
我尝试将 navigation={this.props.navigation} 添加到按钮以允许导航,但没有成功。
const WomenTab = () => (
<View>
<Button onPress={() => {
this.props.navigation.dispatch(StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Wallet' })
],
}))
}}>
<Text>Click</Text>
</Button>
<View>
);
库链接:http://github.com/react-native-community/react-native-tab-view
【问题讨论】:
标签: reactjs react-native react-navigation react-native-navigation