Support file upload/operations from any RCTURLRequestHandler url? #218
Description
Hi! This library supports file upload and copy etc for photos via the old (deprecated) iOS ALAssetLibrary, by matching on the asset-library://
url scheme.
We are starting to integrate https://github.com/olofd/react-native-photos-framework so that our users can upload photos that are stored in iCloud too. That library is integrated with the RCTImageLoader, it has its own url scheme pk://
, so it can load images in <Image />
components.
We will also start using the RN ImageEditor (http://facebook.github.io/react-native/releases/0.36/docs/imageeditor.html#imageeditor) for cropping of photos. The cropped photos gets (temporarily) stored in memory by RCTImageStore
which is also hooked into RCTImageLoader with it's own url schema.
RCTImageLoader has a method called loadImageWithURLRequest
, which takes the photo url, it finds the appropriate ImageLoader and calls back with a UIImage
(which have access to the data).
I suggest that all file operations (where applicable)/upload can fallback to using data from RCTImageLoader, with the added benefit that asset-library files also come for free.
One possible issue is that the RCTImageLoader also loads photos from http
schemes...?
I will implement some small code that just covers our own needs first (copy a ImageLoader image to temporary file), which we can share here, but I cannot promise to do a proper PR as it looks like it would affect a lot of the code here.