question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Won't display assets-library URIs on iOS

See original GitHub issue

Using CameraRoll in react native gives a URI formatted as assets-library://asset/asset.... This used to work with this library. It still works with react’s Image tag. However, this library now shows a blank image instead. Not sure which build caused it as I’m having trouble rolling back.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:24 (12 by maintainers)

github_iconTop GitHub Comments

8reactions
vreality64commented, Nov 22, 2018

I’ve some researched about this issue and conclude it’s SDWebImage’s problem. because they does not support PHAsset which is can handle assets-library protocol.

Please check below comments. react-native-fast-image is currently using SDWebImage@4.2.2 and SDWebImage@5.x is still beta yet. (I found current version through Podfile.lock but not sure)

Maybe we can add PHAsset support in 5.x or by a seperate Pods commented on 25 Jan 2018 in SDWebImage repository

Release status of SDWebImage 5.0.0-beta3 was released on 30 Aug 2018.

However ReactNative’s Image is supporting assets-library. they have logic for assets-library not like SDWebImage@4.x’s local image handling logic which always returns nil about assets-library image.

I think this should be supported by implementing own assets-library handling or upgrading SDWebImage@5.x which is now supporting through SDWebImagePhotosPlugin.

@DylanVann Can you follow up this issue?

1reaction
dreampiggycommented, Feb 4, 2020

I can load images from cameraroll with FastImage but got memory issue when scrolling down to load more photos

Message from debugger: Terminated due to memory issue
  pod 'SDWebImage', '~> 5.0'
  pod 'SDWebImagePhotosPlugin', '~> 1.0'

@r0b0t3d Did you check something documentation of SDWebImagePhotosPlugin-Memory Warning ? Which allows some customization about image loading size.

For iPhone X+ devices, the Camera pixel size is higher than 4000x 4000, so it’s better to limit the size. You can change the default image pixel size using the APIs. For example like this:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Add multiple loaders with Photos Asset support
    [SDImageLoadersManager.sharedManager addLoader:SDWebImagePhotosLoader.sharedLoader];
    // Limit default query pixel size (only 1000x1000)
    SDWebImagePhotosLoader.sharedLoader.imageRequestOptions.sd_targetSize = CGSizeMake(1000, 1000); 
    SDWebImageManager.defaultImageLoader = SDImageLoadersManager.sharedManager;
    
    return YES;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't show Image in React Native - Stack Overflow
See Can't show Image by URI in React Native iOS Simulator ... node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m.
Read more >
Image Gallery — Sample Apps Tutorials - Apple Developer
Retrieve and display images from an asset catalog or a photo library. Welcome to the Image Gallery app. This walkthrough shows how to...
Read more >
Image does not display in Mobile apps & IE
To test this issue, I create an app based on SharePoint Online list which has an image column. the URL of images come...
Read more >
MediaLibrary - Expo Documentation
Otherwise, your app won't have access to the old album directory and expo-media-library won't be able to add new assets to it. However,...
Read more >
Images - React Native
Static Image Resources​. React Native provides a unified way of managing images and other media assets in your Android and iOS apps. To...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found