ascoders / react-native-image-viewer

🚀 tiny & fast lib for react native image viewer pan and zoom
MIT License
2.44k stars 580 forks source link

save image on local #317

Open AceChoong123 opened 5 years ago

AceChoong123 commented 5 years ago

Hi, I'm new to react native, and i just created a component to save image into local device, but i faced some trouble which i don't know whether this component provided the interface to let us using our component to download image. please provide some example tq.

DISKONEKTeD commented 5 years ago

The renderFooter would allow you to access the index of the array of images you feed it

from there you would be able to use the url and save it to your device upon providing some type of button to press to save

you can use 'react-native-fs' (https://github.com/itinance/react-native-fs) to download the image from a url in a temporary directory and then use CameraRoll to save it in your device properly (for iOS you have to do an extra step to make it work tho, search for how to set up CameraRoll in react native iOS)

That said, I will point out that renderFooter seems to be have been broken (I submitted a fix for it tho: https://github.com/ascoders/react-native-image-viewer/pull/324)