mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
Add support for web-style data-uris
Summary: This implements base64-encoded data-uris for the Image component. Closes https://github.com/facebook/react-native/pull/576 Github Author: Colin Ramsay <colinramsay@gmail.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
parent
3de7ad6c33
commit
4838d5921f
@ -547,7 +547,11 @@ RCT_CGSTRUCT_CONVERTER(CGAffineTransform, (@[
|
||||
|
||||
UIImage *image = nil;
|
||||
NSString *path = json;
|
||||
if ([path isAbsolutePath]) {
|
||||
if ([path hasPrefix:@"data:"]) {
|
||||
NSURL *url = [NSURL URLWithString:path];
|
||||
NSData *imageData = [NSData dataWithContentsOfURL:url];
|
||||
image = [UIImage imageWithData:imageData];
|
||||
} else if ([path isAbsolutePath]) {
|
||||
image = [UIImage imageWithContentsOfFile:path];
|
||||
} else {
|
||||
image = [UIImage imageNamed:path];
|
||||
|
Loading…
x
Reference in New Issue
Block a user