Skip to content

Commit

Permalink
fix: ios support ~/ in placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Dec 8, 2020
1 parent db4fd7a commit 3e0d75f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/image.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3e0d75f

Please sign in to comment.