Skip to content

Commit da29b66

Browse files
committed
fix(ios): another fix for loading local image
1 parent e2f46e1 commit da29b66

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/image.ios.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,11 @@ function getUri(src: string | ImageAsset) {
256256
if (found) {
257257
return uri;
258258
}
259-
} else if (uri.indexOf('~/') === 0) {
260-
return NSURL.alloc().initFileURLWithPath(`${path.join(knownFolders.currentApp().path, uri.replace('~/', ''))}`);
259+
else if (uri.indexOf('~/') === 0) {
260+
return NSURL.fileURLWithPath(`${path.join(knownFolders.currentApp().path, uri.replace('~/', ''))}`);
261+
}
262+
else if (uri.indexOf('/') === 0) {
263+
return NSURL.fileURLWithPath(uri);
261264
}
262265
return NSURL.URLWithString(uri);
263266
}
@@ -530,7 +533,7 @@ export class Img extends ImageBase {
530533

531534
// console.log('about to load', this.src, options);
532535
this.nativeViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(
533-
getUri(src),
536+
uri,
534537
this.placeholderImage,
535538
options,
536539
context,

0 commit comments

Comments
 (0)