Open ruoyuruoshui opened 7 years ago
here's how I solved this problem:
defaultImageCacheManager.getCacheInfo().catch(() => {
defaultImageCacheManager.clearCache();
});
If you do not have access to the cache, clear the cache
This is because files are not there anymore and url cache still have this paths for urls. This should be resolved by library itself, cause it makes other problems too. Check PR #91 , library should check if file exists under path returned by url cache before returns it to Image component.
@chrusart Clearing the cache should clear both url cache
and local image files
.
https://github.com/kfiroo/react-native-cached-image/blob/1c0a9c412d08014e8083c8f3b5cc2924e469593b/ImageCacheManager.js#L124-L128
I think the problem is that the CachedImage
doesn't refresh when the cache is cleared, it's data didn't change and so it still displays the old image from memory
@kfiroo if the state of CachedImage state(cachedImagePath, isCacheable) is not reset, image will not be refreshed. i tried to add a listener on clearCache to reset state, it works. but i think this solution is too low, do you has any solution on this?
@ruoyuruoshui I Completely understand the need but I can't think of anything right now :( Suggestions are welcome..
Could you check current version, at least 1.4.2?
+1