CachedImage component for react-native
NetInfo
deprecated change
event to the new connectionChange
- https://github.com/kfiroo/react-native-cached-image/pull/76
ImageCacheProvider
will now correctly prefetch images from nextProps
instead of props
on componentWillReceiveProps
- https://github.com/kfiroo/react-native-cached-image/pull/87
useQueryParamsInCacheKey
when generating cached file name - https://github.com/kfiroo/react-native-cached-image/pull/85
ImageCachePreloader
- https://github.com/kfiroo/react-native-cached-image/pull/89
v1.4.0
contains a lot of breaking changes - please read the readmeThis is a major release that has a lot of breaking changes. All changes came from community requests, I took all the PRs and Issues discussions and compiled them into this new version. If anyone has anything to add/comment this is the place.
ImageCacheManager
ImageCacheProvider
- a top-level component that provides an entry point for customization over the ImageCacheManager
cache
and storage
.
MemoryCache
manages the caching of URLs, this means that for each URL there is an entry in the cache with its expiration date, local file path, etc. - all decisions are made based on the url cache layer.ImageCacheManager
React.createClass
prop-types
instead of the deprecated React.PropTypes
cacheLocation
prop / ImageCacheProvider.options
- https://github.com/kfiroo/react-native-cached-image/pull/38
loadingIndicator
prop to override the default loading indicator - https://github.com/kfiroo/react-native-cached-image/pull/53
fallbackSource
prop to set placeholder image when source.uri
is null or cached failed, the fallbackSource
will be displayed - https://github.com/kfiroo/react-native-cached-image/pull/53
Mainly fixes for Android:
ImageCacheProvider.getCacheInfo()
to retrieve info about the cache in the following format: (Thanks @gameboyVito @YouHan26){
files: [], // an array of all files in the cache represented by their `fs.stat()` result
size: 0 // size of cache in bytes (see example)
}
ImageCacheProvider.seedCache(local: string, url: string, options: CacheOptions): Promise
to seed the cache for a given url with a local image. Useful to avoid having to download an image when you have a local copy. (Thanks @Froelund @hhravn)const SUB_DIR_PATH = 'subDirPath';
so we can implement a simple ImageCacheProvider.clearCache
This will cause images that are already cached to be downloaded again to the new location.NOTE: If you need an easy way to cleanup old images let me know please.
* This is a minor release because current installations will break after upgrading.
As noted by @Froelund here react-native-fs
is not maintained anymore, but its author points to react-native-fetch-blob
as an alternative here
ImageCacheProvider
now uses react-native-fetch-blob
to download the images and save then locally.
NOTE: In order to upgrade you would need to install react-native-fetch-blob
and uninstall react-native-fs
unless you still need it see here :)