戻るときは、デフォルトActions.pop()
で が引数なしで呼び出されます。ページ 1 を更新するには、戻るボタンの機能をオーバーライドして を呼び出す必要がありますActions.pop({refresh:{<propsToSetToPage1>}})
。これはcomponentWillReceiveProps(nextProps)
、ページ 1 でトリガーされます。ここで、nextProps は、pop() に配置した新しい props です。
以下は、react-native-router-flux のドキュメントからのものです。
Actions.pop() will pop the current screen. It accepts following optional params:
{popNum: [number]} allows to pop multiple screens at once
{refresh: {...propsToSetOnPreviousScene}} allows to refresh the props of the scene that it pops back to
PS。Android 向けに開発している場合は、ユーザーがハードウェアの [戻る] ボタンを押したときにもこれを行うことができます。React Native の公式ドキュメントでBackAndroidを確認してください。