daily-share icon indicating copy to clipboard operation
daily-share copied to clipboard

react-native 路由如何返回两级(2022-8-3)

Open yaogengzhu opened this issue 2 years ago • 0 comments

需求:

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

实现

  • 在B界面获取key(key = this.props.navigation.state.key)
  • 将key通过this.props.navigation.navigate('page',{key:key})的方式从B传到C,
  • 在C中通过this.props.navigation.state.params.key获取key的值,在C界面用
this.props.navigation.goBack(this.props.navigation.state.params.key)

就可以实现C->A

yaogengzhu avatar Aug 03 '22 07:08 yaogengzhu