react-native: [iOS] Image component unable to load iCloud photos via 'assets-library://' stored in cloud
Using the Image
component with a URI pointing to an assets-library://
source can result in a failure to load the image with iCloud Photo Library enabled.
If the source image is not available on the device, (i.e. currently stored in the cloud and the device only has metadata information available), the Image component will render blank and trigger the onError
handler. Viewing the full resolution photo in an iCloud Photo Library aware application (such as Photos) will allow the image to load, as the device will now have the image available.
I suspect the larger issue is React Native using the deprecated ALAssetsLibrary over the newer iCloud Photo Library-aware Photos Frameworks available in iOS 8 and later. Migrating to the newer framework will allow the Photos Framework to handle the behind-the-scenes work of fetching missing photos from iCloud.
Occurs in React Native Version: 0.29.2
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (2 by maintainers)
I’m working on a library called react-native-photos-framework that can access assets from local camera-roll and iCloud using Apples Photos-framework. Its starting to take form and will be able to do most things you can do with Apples native API’s. This includes: Loading images from iCloud (Custom RN-Image-Loader), Loading albums and collections from iCloud, Creating Albums, Deleting and saving assets in albums etc.
I’m also implementing more low-lever features such as change-detection in asset-collections. And caching for large number of assets. Check it out if your interested.
@gre Check line 93: https://github.com/thesocialstation/react-native/blob/3291c504bc0aed1df47be823b5a68f3eaa5dd388/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m#L93
The setting does gets passed into
requestImageForAsset
, which is iCloud aware. The class already had progress handling implemented, so it will be treated similarly to downloading a file from the web. 😄@samuelkraft I submitted PR #9530 to resolve the iCloud downloading issue.
If you would like to use the fix immediately, I cherry-picked the fix into RN v0.31 here: https://github.com/thesocialstation/react-native/tree/0.31-stable
You can use
"react-native": "thesocialstation/react-native#0.31-stable"
in your package.json.