在 React Native 中更改新 url 时图像不会更改

发布于 2025-01-18 06:57:53 字数 684 浏览 2 评论 0原文

我正在使用lib react-fast-fast-image用于显示他的图像。

但是我有一个问题,即我的图像是进入新URL 后不令人耳目一新的问题,我也再次称为SetState。我使用钩子

在下面的链接中增加了时间来修复它:

setImage(ping_push_media + respone + tesne +'?'?' + new date()。getTime()。getTime());

我已经了解到, 图像闪烁每当我在Android上进行测试的状态发生变化时

,但在iOS上似乎也有同样的问题,

我的URL图像是否存在问题?我的图像路径是HTTP不是HTTP,但似乎也对HTTPS不起作用。

我还将缓存模式用作不变的,但是为什么它仍然不起作用呢?

<FastImage
       source={{
         uri: PING_PUSH_MEDIA + profile?.avatar,
       }}
       style={styles.itemAvatar}
       cache={FastImage.cacheControl.immutable}
/>

请帮我。谢谢!

I'm using lib react-native-fast-image for the display of his image.

But i'm having a problem that my image is not refreshing after enter new url, I have also called setState again. I use Hook

I have learned that adding time to the link to fix it, below:

setImage(PING_PUSH_MEDIA + respone + '?' + new Date().getTime());

But this results in the image flicker every time the state changes

I'm testing on android, but seems to have the same problem on iOS too

Is there a problem with my url image? My image path is http not https, but it also doesn't seem to work on https.

I also used cache mode as immutable, but why is it still not working?

<FastImage
       source={{
         uri: PING_PUSH_MEDIA + profile?.avatar,
       }}
       style={styles.itemAvatar}
       cache={FastImage.cacheControl.immutable}
/>

Please, help me. Thanks all !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文