@@ -55,7 +55,7 @@ function getSVGKImage(src: string | ImageAsset | File) {
5555 }
5656 if ( Utils . isFileOrResourcePath ( imagePath ) ) {
5757 if ( imagePath . indexOf ( Utils . RESOURCE_PREFIX ) === 0 ) {
58- const resName = imagePath . substr ( Utils . RESOURCE_PREFIX . length ) ;
58+ const resName = imagePath . slice ( Utils . RESOURCE_PREFIX . length ) ;
5959 return SVGKImage . imageNamed ( resName ) ;
6060 } else if ( imagePath . indexOf ( '~/' ) === 0 ) {
6161 const strPath = path . join ( knownFolders . currentApp ( ) . path , imagePath . replace ( '~/' , '' ) ) ;
@@ -320,14 +320,29 @@ export class SVGView extends SVGViewBase {
320320 }
321321 super . onMeasure ( widthMeasureSpec , heightMeasureSpec ) ;
322322 }
323- [ srcProperty . setNative ] ( value ) {
324- this . nativeViewProtected . image = getSVGKImage ( value ) ;
323+ async handleSrc ( src ) {
324+ if ( src instanceof Promise ) {
325+ this . handleSrc ( await src ) ;
326+ return ;
327+ } else if ( typeof src === 'function' ) {
328+ const newSrc = src ( ) ;
329+ if ( newSrc instanceof Promise ) {
330+ await newSrc ;
331+ }
332+ this . handleSrc ( newSrc ) ;
333+ return ;
334+ }
335+ this . nativeViewProtected . image = getSVGKImage ( src ) ;
325336 // this.nativeViewProtected.renderer = getRenderer(value);
326337 if ( this . _imageSourceAffectsLayout ) {
327338 this . _imageSourceAffectsLayout = false ;
328339 this . requestLayout ( ) ;
329340 }
330341 }
342+
343+ [ srcProperty . setNative ] ( value ) {
344+ this . handleSrc ( value ) ;
345+ }
331346 [ stretchProperty . setNative ] ( value : 'none' | 'aspectFill' | 'aspectFit' | 'fill' ) {
332347 this . nativeViewProtected . contentMode = getUIImageScaleType ( value ) ;
333348 // switch (value) {
0 commit comments