Skip to content

Commit 3e0d75f

Browse files
committed
fix: ios support ~/ in placeholder
1 parent db4fd7a commit 3e0d75f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/image.ios.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,17 +428,20 @@ export class Img extends ImageBase {
428428
this.handleImageProgress(totalSize > 0 ? currentSize / totalSize : -1, totalSize);
429429
};
430430

431-
private getUIImage(path: string | ImageSource) {
431+
private getUIImage(imagePath: string | ImageSource) {
432432
if (!path) {
433433
return null;
434434
}
435435
let image;
436-
if (typeof path === 'string') {
437-
if (isFileOrResourcePath(path)) {
438-
image = ImageSource.fromFileOrResourceSync(path);
436+
if (typeof imagePath === 'string') {
437+
if (imagePath.indexOf('~/') === 0) {
438+
imagePath = path.join(knownFolders.currentApp().path, imagePath.substring(2));
439+
}
440+
if (isFileOrResourcePath(imagePath)) {
441+
image = ImageSource.fromFileOrResourceSync(imagePath);
439442
}
440443
} else {
441-
image = path;
444+
image = imagePath;
442445
}
443446

444447
// console.log("getUIImage", path, !!image, !!image && !!image.ios);

0 commit comments

Comments
 (0)