From 3e0d75f06e5a96327449bf2e9f65c3d35515a0be Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Tue, 8 Dec 2020 11:27:54 +0100 Subject: [PATCH] fix: ios support ~/ in placeholder --- src/image.ios.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/image.ios.ts b/src/image.ios.ts index 94f20a8..02c27a8 100644 --- a/src/image.ios.ts +++ b/src/image.ios.ts @@ -428,17 +428,20 @@ export class Img extends ImageBase { this.handleImageProgress(totalSize > 0 ? currentSize / totalSize : -1, totalSize); }; - private getUIImage(path: string | ImageSource) { + private getUIImage(imagePath: string | ImageSource) { if (!path) { return null; } let image; - if (typeof path === 'string') { - if (isFileOrResourcePath(path)) { - image = ImageSource.fromFileOrResourceSync(path); + if (typeof imagePath === 'string') { + if (imagePath.indexOf('~/') === 0) { + imagePath = path.join(knownFolders.currentApp().path, imagePath.substring(2)); + } + if (isFileOrResourcePath(imagePath)) { + image = ImageSource.fromFileOrResourceSync(imagePath); } } else { - image = path; + image = imagePath; } // console.log("getUIImage", path, !!image, !!image && !!image.ios);