如何通过 react-native-router -flux 在 react-native 中更新回(上一个)屏幕 [英] How to update back(previous) screen in react-native by react-native-router -flux

查看:54
本文介绍了如何通过 react-native-router -flux 在 react-native 中更新回(上一个)屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用 react-native-router-flux.

I am using react-native-router-flux in my application.

-我在第一个屏幕上使用参数,然后导航到第二个屏幕.

-I am using a parameter at my first screen and then i navigate to second screen.

-在第二个屏幕上,我正在更新在我的第一个屏幕上使用的参数.

-On the second screen i am updating that parameter which was used at my first screen.

-我希望它在我导航回该屏幕(第一个屏幕)时进行更新.

-I want it to be updated when i navigate back to that screen (first screen).

如何实现此功能.

谢谢

推荐答案

我在没有使用 Redux 的情况下解决了这个问题.

I Solved this Issue without using Redux.

将 Screen First 的 api 调用语句放在一个方法中(在 First Screen 上)并将其传递给第二个屏幕.在第二个屏幕上,我在 componentWillUnmount() 中调用了这个方法.它正在更新我的第一个屏幕,因为我将从第二个屏幕返回.

Put the api calling statement of Screen First in a method(on First Screen) and passed it to second screen. On the second screen i called this method inside componentWillUnmount(). Its updating my first screen as i will be going back from screen second.

这篇关于如何通过 react-native-router -flux 在 react-native 中更新回(上一个)屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆