Skip to content

Commit

Permalink
[iOS] Fix image wrong scale factor when load image from file system
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw committed Feb 13, 2019
1 parent 08a6b57 commit a69d21a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions React/Base/RCTUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,11 @@ BOOL RCTIsLocalAssetURL(NSURL *__nullable imageURL)

if (!image) {
// Attempt to load from the file system
NSData *fileData;
if (imageURL.pathExtension.length == 0) {
fileData = [NSData dataWithContentsOfURL:[imageURL URLByAppendingPathExtension:@"png"]];
} else {
fileData = [NSData dataWithContentsOfURL:imageURL];
NSString *filePath = imageURL.path;
if (filePath.pathExtension.length == 0) {
filePath = [filePath stringByAppendingPathExtension:@"png"];
}
image = [UIImage imageWithData:fileData];
image = [UIImage imageWithContentsOfFile:filePath];
}

if (!image && !bundle) {
Expand Down

0 comments on commit a69d21a

Please sign in to comment.