Skip to content

Commit c42d2c2

Browse files
committed
fix(android): coerce string width/height in ImageAssetOptions #6289
1 parent 8d3c3c3 commit c42d2c2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/core/image-asset/index.android.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ export class ImageAsset extends ImageAssetBase {
2626
}
2727

2828
public getImageAsync(callback: (image, error) => void) {
29+
// Fix for issue #6289: ensure numeric width/height
30+
if (this.options) {
31+
if (typeof this.options.width === "string") {
32+
this.options.width = parseInt(this.options.width, 10);
33+
}
34+
if (typeof this.options.height === "string") {
35+
this.options.height = parseInt(this.options.height, 10);
36+
}
37+
}
38+
2939
org.nativescript.widgets.Utils.loadImageAsync(
3040
getNativeApp<android.app.Application>().getApplicationContext(),
3141
this.android,
@@ -42,4 +52,5 @@ export class ImageAsset extends ImageAssetBase {
4252
}),
4353
);
4454
}
55+
4556
}

0 commit comments

Comments
 (0)