alwx / react-native-photo-view

Pinch-to-zoom view for React Native (both iOS and Android)
MIT License
815 stars 434 forks source link

Possible to use react-native-fast-image for the image? #95

Open gitlovenotwar opened 7 years ago

gitlovenotwar commented 7 years ago

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.

gitlovenotwar commented 7 years ago

P.S. Everytime the image dismounted and mounted again, it loads again the image.

freerk commented 6 years ago

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.

oferRounds commented 6 years ago

+1

filipmadej commented 6 years ago

+1

flyinghawker commented 6 years ago

+1

ahmaddehnavi commented 5 years ago

+1

gitlovenotwar commented 5 years ago

It's over a year already when I posted this, and I haven't found any solution :(

maartenvandillen commented 5 years ago

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.

brownieboy commented 5 years ago

@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.

maartenvandillen commented 5 years ago

@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.

brownieboy commented 5 years ago

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