React native 在react native中,我希望在执行poptoop之后在组件中执行一个方法

React native 在react native中,我希望在执行poptoop之后在组件中执行一个方法,react-native,React Native,我有一个显示仪表板的导航器 <Navigator ref="nav" navigationBarHidden={true} style={styles.container} initialRoute={{name: 'dashboard'}} renderScene={this.renderScene} configureScene={() => { returnNavigator.SceneConfigs.PushFromRight; }} /> 要

我有一个显示仪表板的导航器

<Navigator
  ref="nav"
  navigationBarHidden={true}
  style={styles.container}
  initialRoute={{name: 'dashboard'}}
  renderScene={this.renderScene}
  configureScene={() => { returnNavigator.SceneConfigs.PushFromRight; }}
/>
要返回,不幸的是计数器仍然是一样的,当我返回仪表板以重置篮中的计数器时,如何调用该方法,或者如何再次调用componentDidMount?

您需要使用另一个方法,例如
componentWillReceiveProps
componentWillUpdate
。如果这修复了你的bug,很难说,因为你没有提供足够的代码来理解你的应用程序中发生了什么

this.props.navigator.popToTop()