File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -487,10 +487,13 @@ export class Img extends ImageBase {
487487 // this.initImage();
488488 // }
489489
490- private initImage ( ) {
490+ private async initImage ( ) {
491491 if ( this . nativeViewProtected ) {
492492 // this.nativeViewProtected.setImageURI(null);
493- const src = this . src ;
493+ let src = this . src ;
494+ if ( src instanceof Promise ) {
495+ src = await src ;
496+ }
494497 if ( src ) {
495498 let drawable : android . graphics . drawable . BitmapDrawable ;
496499 if ( src instanceof ImageSource ) {
Original file line number Diff line number Diff line change 1- import { ImageSource , View } from '@nativescript/core' ;
1+ import { ImageAsset , ImageSource , View } from '@nativescript/core' ;
22
33
44/**
@@ -75,7 +75,7 @@ export class Img extends View {
7575 /**
7676 * String value used for the image URI.
7777 */
78- src : string | ImageSource ;
78+ src : string | ImageSource | ImageAsset | Promise < string | ImageSource | ImageAsset > ;
7979
8080 /**
8181 * String value used for the lower res image URI.
Original file line number Diff line number Diff line change @@ -357,9 +357,12 @@ export class Img extends ImageBase {
357357 return image ;
358358 }
359359
360- private initImage ( ) {
360+ private async initImage ( ) {
361361 if ( this . nativeViewProtected ) {
362- const src = this . src ;
362+ let src = this . src ;
363+ if ( src instanceof Promise ) {
364+ src = await src ;
365+ }
363366 if ( src ) {
364367 const animate = this . fadeDuration > 0 ;
365368 if ( src instanceof ImageSource ) {
You can’t perform that action at this time.
0 commit comments