2017-08-09 202 views
0

在React Native中更改头像时,我遇到了问题。 我使用react-native-router和Actions来移动屏幕。 当我在个人资料屏幕上更改头像时。这是成功。但是当我回到主页时。它不会更改头像,因为它不刷新。它使用旧数据。 请给我一个解决方案,帮助我。谢谢。如何在React Native中更改和设置新的头像?

这里是分布屏幕

enter image description here

下面是主页

enter image description here

+0

这将是更有帮助,如果你可以张贴一些代码。 –

回答

0

当你调用Actions.pop({刷新:{重装: '重装'}})componentWillReceiveProps是在之前的场景中调用,您可以更新当前组件。

0

你必须调用方法componentWillReceiveProps在网页上,类似

componentWillReceiveProps(nextProps) { 
    if (nextProps.avatar.object) { 
    * here update field responsible for rendering avatar img in component* 
    } 
} 
相关问题