Skip to content

Commit

Permalink
fix(ios): another fix for loading local image
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Feb 4, 2021
1 parent e2f46e1 commit da29b66
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/image.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,11 @@ function getUri(src: string | ImageAsset) {
if (found) {
return uri;
}
} else if (uri.indexOf('~/') === 0) {
return NSURL.alloc().initFileURLWithPath(`${path.join(knownFolders.currentApp().path, uri.replace('~/', ''))}`);
else if (uri.indexOf('~/') === 0) {
return NSURL.fileURLWithPath(`${path.join(knownFolders.currentApp().path, uri.replace('~/', ''))}`);
}
else if (uri.indexOf('/') === 0) {
return NSURL.fileURLWithPath(uri);
}
return NSURL.URLWithString(uri);
}
Expand Down Expand Up @@ -530,7 +533,7 @@ export class Img extends ImageBase {

// console.log('about to load', this.src, options);
this.nativeViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(
getUri(src),
uri,
this.placeholderImage,
options,
context,
Expand Down

0 comments on commit da29b66

Please sign in to comment.