-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS "Camera Roll" Images rendering as white views #543
Comments
To add support for camera roll:
Example code (for step 2): import FastImage from "react-native-fast-image";
import React from "react";
import hoistNonReactStatics from "hoist-non-react-statics";
const CustomFastImage = React.forwardRef(({ source, ...props }, ref) => {
if (
typeof source === "object" &&
typeof source.uri === "string" &&
source.uri.startsWith("ph://")
) {
const { uri, ...otherSource } = source;
return (
<FastImage
ref={ref}
source={{
uri: uri.replace("ph://", "photos://asset/"),
...otherSource
}}
{...props}
/>
);
} else {
return <FastImage ref={ref} source={source} {...props} />;
}
});
export const Image = hoistNonReactStatics(CustomFastImage, FastImage); You'd also want to set it not to cache the images, or set the max cache size so that it doesn't fill up all your device's memory and then crash:
|
Thank you, I will definitely try this in the next days and I'll let you know. |
SDWebImagePhotosDefine.h in SDWebImagePhotosPlugin the @import SDWebImage has error "Module SDWebImage not found" |
@eyu0415 Seeing the same thing after following the installation instructions. |
@Jarred-Sumner Do you have an example project on with FastImage and RN and SDWebImage installed and working? |
@dreampiggy Im also seeing the error above? Any ideas |
What's the install method, why does not SDWebImage a clang module ? This import issue seems a little strange. Any demo here ? |
@dreampiggy |
Hi. @priteshbaviskar Can you provide a simple demo, contains:
So that I can find out the reason ? From the description, I guess this maybe something project configuration related to The |
I guess I know the reason. CocoaPods's static library is not supported with module. I'll push a new version to support both of them (Sounds tricky) For now, you can add this into your Podfile: use_modular_headers! #important
pod 'SDWebImage', "~> 5.0"
pod 'SDWebImagePhotosPlugin', "~> 1.0" |
@priteshbaviskar @bakerac4 @bobber205 For the compile error of that module import, you can either upgrade to the Photos Plugin V1.0.1 version, or using the |
EDIT (2020-07-06): I don't recommend using the Old comments below: Thanks @dreampiggy for the pointers! For those running into the same issue, these are the steps I took as of April, 2020 to get the photos displaying:
Thanks @Jarred-Sumner for pointing me in the right direction! Note that that comment is a bit outdated now: |
I followed your steps @pxpeterxu but it didn't solve the problem for me, I still have a white image in place of the actual image. |
@remigallego I actually don't recommend using the |
See Readme. We already provide the Native API to control the Photo loading size, rendering mode, image type (Normal Image/LivePhoto/GIF/Video Poster). // request-level options
// allows iCloud Photos Library
let requestOptions = PHImageRequestOptions()
requestOptions.networkAccessAllowed = true
requestOptions.sd_targetSize = CGSize(width: 1000, 1000)
imageView.sd_setImage(with: photosURL, placeholderImage: nil, context:[.photosImageRequestOptions: requestOptions]) And I post this in the The thing you can do, it's to write JavaScript wrapper. For example, you can pass through the That it's react-native-fast-image or react-native-fast-image-photos's duty. Maybe what I can do better, it's to write a standalone chapter about React Native user ? Changing the default behavior to return a smaller size of Photos Image, may not sounds reasonable. Think if you're a framework author, what of size you should use to return to the user, if user don't provide any context information ? |
SDWebImagePhotosPlugin released v1.1.0. This version change the Default Query Image Size from full pixel size, into the largest size system provide (which is smaller than full size, based on iOS System optimization). It's still recommended to use Native API to limit the fetch image size, until react-native-fast-image itself provide the JavaScript bridge API (for example, pass the PS: Is this repo still get maintained ? 😕 |
Almost a year later, this issue is still happening. Anyone got any idea on how to fix it properly? |
@dreampiggy PH Asset photo is loaded with SDWebImage Photos Plugin but PH asset video is white, do you have any solution? |
@hantrungkien And, you can fire a issue here https://github.com/SDWebImage/SDWebImagePhotosPlugin/issues/new/choose |
ONLY on iOS when rendering device cached images from camera roll the component renders white views.
Steps to reproduce the behavior:
Expected behavior
Normal image rendering.
Dependency versions
The text was updated successfully, but these errors were encountered: