有两个图像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 : 'firebasestorage.googleapis/v0/b/siren-5eee7.appspot/o/profile%2FmO2vxzWDbJRzM5ckzCBXtf0aPhV2?alt=media'}} /> <Image style={{ width: 100, height: 100 }} source={{ uri : '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.google/docs/reference/js/firebase.storage.SettableMetadata#cacheControl
请参阅此文档,我认为您必须在将图像存储到Firebase存储器时设置元数据.
See this documentation I think you have to set metadata while storing the image to the Firebase storage.
更多推荐
Firebase存储图像缓存不起作用
发布评论