Firebase存储图像缓存不起作用 [英] Firebase storage Image cache not working
问题描述
有两个图像uri,第一个位于 firebase存储中,第二个是 react-native博客中的示例图像.
There are two image uri, first one is located in firebase storage and second one is a sample image in react-native blog.
而且我相信recat-native的Image
组件是可缓存的.
And I believe recat-native's Image
component is cacheable.
<View>
<Image
style={{ width: 100, height: 100 }}
source={{ uri : 'https://firebasestorage.googleapis.com/v0/b/siren-5eee7.appspot.com/o/profile%2FmO2vxzWDbJRzM5ckzCBXtf0aPhV2?alt=media'}}
/>
<Image
style={{ width: 100, height: 100 }}
source={{ uri : 'https://facebook.github.io/react-native/img/react-native-congratulations.png'}}
/>
<View>
问题
我认为Firebase存储的映像未缓存.当我渲染屏幕时,它总是尝试下载.因此,第二个图像的加载速度更快,一秒钟后,firebase图像也会加载.
I think firebase storage's image is not cached. when I render screen it always trying to download. So the second image load faster, and after one second, firebase image is loaded.
如何使Firebase存储映像可缓存?
您可以测试上面的代码!
You can test above code!
推荐答案
请参阅此文档,我认为您必须在将图像存储到Firebase存储器时设置元数据.
See this documentation I think you have to set metadata while storing the image to the Firebase storage.
这篇关于Firebase存储图像缓存不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!