react-native-photo-view
react-native-photo-view copied to clipboard
Possible to use react-native-fast-image for the image?
Hi,
The image seems to load again when it's mounted... I have a view when tap and shows the photoview, image is cached already using react-native-fast-image. Somehow it loads again, so I was wondering if it's possible to use it for the image.
P.S. Everytime the image dismounted and mounted again, it loads again the image.
Also ran into this. For some reason iOS caching is acting weird. Would be great if react-native-photo-view would provide a solution so that not all images are loaded every time a screen is mounted. It causes a lot of unnecessary downloads that are negatively impacting user-experience.
+1
+1
+1
+1
It's over a year already when I posted this, and I haven't found any solution :(
I think I found a solution. I am using react-native-cached-image and it is possible to get the local file name of a cached image by calling:
ImageCacheManager().downloadAndCacheUrl(url).then(cachedFilePath => { })
Then I use this when constructing the source prop of a PhotoView
.
@maartenvandillen,
Is react-native-cached-image still being maintained? Last commit was Oct 2017.
It also uses react-native-fetch-blob, which is definitely no longer being maintained. There is an active fork, rn-fetch-blob, but react-native-cached-image was never changed to use it.
@brownieboy No it seems it is no longer being maintained. But I got everything working, by also adding the rn-fetch-blob package and making sure it is being used on the native side instead of react-native-fetch-blob. It's not a future safe solution, but what is these days.
I had a look to see if there was an equivalent way of getting the cached file path in react-native-fast-image, but it seems not.
There have been two PRs submitted to add such functionality, but they don't seem to have been merged: https://github.com/DylanVann/react-native-fast-image/pull/228 https://github.com/DylanVann/react-native-fast-image/pull/351