React Native - 图像缓存 [英] React Native - Image Cache

查看:62
本文介绍了React Native - 图像缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本站阅读了有关 React Native 图像组件的文档并提出了一些问题:https://facebook.github.io/react-native/docs/image.html

I read the document about the React Native image component in this site and got some questions: https://facebook.github.io/react-native/docs/image.html

  1. 如果我使用 source 属性来显示图像.图片下载后会缓存保存到磁盘吗?

  1. If I use the source property to display image. Will the image be cached and save to disk after download?

如果是,缓存策略是什么?

If yes, what is the cache policy?

如果我想将下载的图像保存到磁盘.使用 getSize 或 prefetch 方法更好吗?

If I want to save the downloaded image to disk. Is it better to use getSize or prefetch method to do it?

非常感谢.

推荐答案

React 本机图像组件 NSURLRequest 的缓存策略如此处.我个人使用 RNFetchBlob 缓存图像,如此处所述.您还可以查看这个组件.

React native image component NSURLRequest's cache policy as described here. Personally I use RNFetchBlob to cache images as described here. You can also checkout this component.

这篇关于React Native - 图像缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆