Add support for data: Uri scheme to RCTImageView (e.g. base64-encoded images)
Summary: ImageRequestHelper was not handling data: scheme correctly, which resulted in images failing to load. This diff is fixing it by considering \"data:\" as a Uri resource, and piping it appropriately. Reviewed By: sriramramani Differential Revision: D2919403
This commit is contained in:
parent
88ebce0512
commit
0b6436b637
|
@ -28,7 +28,7 @@ import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|||
}
|
||||
|
||||
final ImageRequestBuilder imageRequestBuilder;
|
||||
if (isNetworkResource(source)) {
|
||||
if (isUriResource(source)) {
|
||||
imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(source));
|
||||
} else {
|
||||
Resources resources = context.getResources();
|
||||
|
@ -42,7 +42,10 @@ import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|||
return imageRequestBuilder.build();
|
||||
}
|
||||
|
||||
private static boolean isNetworkResource(String source) {
|
||||
return source.startsWith("http://") || source.startsWith("https://");
|
||||
private static boolean isUriResource(String source) {
|
||||
return
|
||||
source.startsWith("http://") ||
|
||||
source.startsWith("https://") ||
|
||||
source.startsWith("data:");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue