react-navigation导航栏嵌套
2019-08-09 本文已影响0人
Tzhen
1.导航栏传参:
设置参数:this.props.navigation.setParams({
otherParam: “something to pass”
});
获取参数:
this.props.navigation.getParam('otherParam')
或
this.props.navigation.state.params.otherParam
------------------------分割线--------------------------------
当存在导航栏嵌套了子导航栏时,该页面设置的参数只存放于控制该页面的导航栏控制器:
即:父导航栏想要获取子导航栏下页面设置的参数如图:
this.props.navigation.state.routes[0].params.otherParam

以上内容仅供参考哈!