gpt4 book ai didi

android - React Native Image 不会改变

转载 作者:行者123 更新时间:2023-12-04 23:53:45 25 4
gpt4 key购买 nike

当我打开个人资料选项卡时,它会从 URL 加载图像(个人资料图像),如果用户想要更改他的图像,他可以但是当他这样做时,图像在服务器上发生了变化,但在应用程序上却没有更改,但如果我刷新应用程序,它确实会更改。

当用户登录他在 URL 上有图像时,URL 不会改变,当他更新图像时,URL 相同但图片不同。

<Image style={{height: 70, width:70,borderRadius: 35}} source={{uri:'http://********************/'+GLOBAL.api_token}} />

最佳答案

if(imagechanged(localparam)) {
<Image source={{uri:ImageURL}} />
} else {
<Image source={{uri:ImageURL}} />
}

if else 中,您需要执行相同的图像 URL 但条件已更改。

你只需要设置本地参数就可以知道 URL 中的图像是否发生了变化。

对于缓存问题,只需在 URL 后添加日期参数,这样每次它都会拍摄新图像。喜欢就关注

imageURL = "http://localhost/image/id/image.jpg?time=" + new Date();

关于android - React Native Image 不会改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43976241/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com