在navigator.pop()上刷新组件

Mat*_*Aft 7 react-native

我正在使用React Native的Navigator.无论如何都要刷新组件,所以当我回到它时,它将进行一个新的API调用并获取更新的数据以显示在组件中.我发现了一些类似的问题,但没有好的答案......

loc*_*ton 1

您应该保存state页面并发出一个操作,componentDidMount因为它是在安装组件后立即调用的。

参考:

  1. https://facebook.github.io/react/docs/react-component.html
  2. https://github.com/ReactTraining/react-router

添加

由于您的组件已经安装,您应该ComonentWillReceiveProps改为监听。