【发布时间】:2018-08-05 18:02:57
【问题描述】:
我想通过主屏幕中的按钮单击操作将路由参数发送到配置文件选项卡。下面的代码是标签导航器
const Tabs = TabNavigator({
[routes.HOME]: {
screen: FeedMainScreen,
navigationOptions: {
tabBarLabel: tabBarLabels.HOME_TAB_LABEL,
},
},
[routes.SEARCH]: {
screen: SearchScreen,
navigationOptions: {
tabBarLabel: tabBarLabels.SEARCH_TAB_LABEL,
},
},
[routes.PROFILE]: {
screen: ProfileScreen,
navigationOptions: {
tabBarLabel: tabBarLabels.PROFILE_TAB_LABEL,
},
},
}
和按钮点击导航是这样的
<Button onPress={() => this.props.navigation.navigate(routes.PROFILE, { id: this.props.user._id }, null)} />
并像这样从个人资料屏幕访问参数
constructor (props) {
super(props)
console.log('NavPrams', this.props.navigation.state)
}
总是不明确的
【问题讨论】:
标签: react-native react-navigation