我有像这样的tabnavigator
var TabNavigation = createBottomTabNavigator({
NearbyScreen: {
screen: Nearby
},
FindScreen:{
screen: LandmarkNavigation
},
NotificationScreen:{
screen: Notifications
},
MyProfile:{
screen: MyProfile
}
})
在组件中呈现
render() {
//console.log(this.props);
var nearbyLocations = this.props.locationsNearby;
return(
<TabNavigation thisThing="thisThingValue" />
)
}
如何访问我在其中一个标签页面中传递的道具的价值?
答案 0 :(得分:1)
我用screenProps解决了它:
return(
<TabNavigation screenProps={thing} />
)
通过this.props.screenProps
可以在导航器标签视图中访问它答案 1 :(得分:0)
尝试通过此处访问this.props.navigation.state.params.thisThing