react-native navigation返回上两层界面

参考文档(摘自):https://blog.csdn.net/sun_DongLiang/article/details/86707388

需求:

A->B->C  然后想从C->A

实现

1.在B界面获取key(key = this.props.navigation.state.key),

2.将key通过this.props.navigation.navigate('page',{key:key})的方式从B传到C,

3.在C中通过this.props.navigation.state.params.key获取key的值,在C界面用this.props.navigation.goback(this.props.navigation.state.params.key),就可以实现C->A

 

参考文档(摘自):https://blog.csdn.net/sun_DongLiang/article/details/86707388​​​​​​​

 

 

你可能感兴趣的:(react-native,navigation)