@nativescript-community/ui-image 4.3.10 → 4.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.android.js CHANGED
@@ -1,10 +1,8 @@
1
1
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
2
2
  export * from './index-common';
3
- import { Color, Image, ImageAsset, ImageSource, Trace, Utils, knownFolders, path } from '@nativescript/core';
4
- import { android as androidApp } from '@nativescript/core/application';
3
+ import { Application, Background, Color, ImageAsset, ImageSource, Trace, Utils, backgroundInternalProperty, knownFolders, path } from '@nativescript/core';
5
4
  import { isString } from '@nativescript/core/utils/types';
6
- import { CLog, CLogTypes, EventData, ImageBase, ScaleType } from './index-common';
7
- import { layout } from '@nativescript/core/utils/layout-helper';
5
+ import { CLog, CLogTypes, EventData, ImageBase, ScaleType, aspectRatioProperty, backgroundUriProperty, blurDownSamplingProperty, blurRadiusProperty, fadeDurationProperty, failureImageUriProperty, imageRotationProperty, lowerResSrcProperty, placeholderImageUriProperty, progressBarColorProperty, roundAsCircleProperty, roundBottomLeftRadiusProperty, roundBottomRightRadiusProperty, roundTopLeftRadiusProperty, roundTopRightRadiusProperty, showProgressBarProperty, srcProperty, stretchProperty, tintColorProperty } from './index-common';
8
6
  let initialized = false;
9
7
  let initializeConfig;
10
8
  export function initialize(config) {
@@ -42,14 +40,16 @@ export function initialize(config) {
42
40
  initializeConfig = null;
43
41
  }
44
42
  }
43
+ let imagePineLine;
45
44
  export function getImagePipeline() {
46
- if (androidApp) {
47
- const nativePipe = com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline();
48
- const imagePineLine = new ImagePipeline();
49
- imagePineLine.android = nativePipe;
50
- return imagePineLine;
45
+ if (!imagePineLine) {
46
+ if (Application.android.nativeApp) {
47
+ const nativePipe = com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline();
48
+ imagePineLine = new ImagePipeline();
49
+ imagePineLine.android = nativePipe;
50
+ }
51
51
  }
52
- return null;
52
+ return imagePineLine;
53
53
  }
54
54
  export function shutDown() {
55
55
  if (!initialized) {
@@ -59,7 +59,7 @@ export function shutDown() {
59
59
  com.facebook.drawee.view.SimpleDraweeView.shutDown();
60
60
  com.facebook.drawee.backends.pipeline.Fresco.shutDown();
61
61
  }
62
- function getUri(src) {
62
+ function getUri(src, asNative = true) {
63
63
  let uri;
64
64
  let imagePath;
65
65
  if (src instanceof ImageAsset) {
@@ -73,20 +73,24 @@ function getUri(src) {
73
73
  const resName = imagePath.substring(Utils.RESOURCE_PREFIX.length);
74
74
  const identifier = Utils.ad.resources.getDrawableId(resName);
75
75
  if (0 < identifier) {
76
- uri = new android.net.Uri.Builder().scheme(com.facebook.common.util.UriUtil.LOCAL_RESOURCE_SCHEME).path(java.lang.String.valueOf(identifier)).build();
76
+ const netUri = new android.net.Uri.Builder().scheme(com.facebook.common.util.UriUtil.LOCAL_RESOURCE_SCHEME).path(java.lang.String.valueOf(identifier)).build();
77
+ if (asNative) {
78
+ return netUri;
79
+ }
80
+ uri = netUri.toString();
77
81
  }
78
82
  }
79
83
  else if (imagePath.indexOf('~/') === 0) {
80
- uri = android.net.Uri.parse(`file:${path.join(knownFolders.currentApp().path, imagePath.replace('~/', ''))}`);
84
+ uri = `file:${path.join(knownFolders.currentApp().path, imagePath.replace('~/', ''))}`;
81
85
  }
82
86
  else if (imagePath.indexOf('/') === 0) {
83
- uri = android.net.Uri.parse(`file:${imagePath}`);
87
+ uri = `file:${imagePath}`;
84
88
  }
85
89
  }
86
90
  else {
87
- uri = android.net.Uri.parse(imagePath);
91
+ uri = imagePath;
88
92
  }
89
- return uri;
93
+ return asNative ? android.net.Uri.parse(uri) : uri;
90
94
  }
91
95
  export class ImagePipeline {
92
96
  toUri(value) {
@@ -263,7 +267,7 @@ export const needRequestImage = function (target, propertyKey, descriptor) {
263
267
  this._needRequestImage = true;
264
268
  // we need to ensure a hierarchy is set or the default aspect ratio wont be set
265
269
  // because aspectFit is the default (wanted) but then we wont go into stretchProperty.setNative
266
- this._needUpdateHierarchy = true;
270
+ // this._needUpdateHierarchy = true;
267
271
  return;
268
272
  }
269
273
  return originalMethod.apply(this, args);
@@ -285,7 +289,7 @@ export class Img extends ImageBase {
285
289
  this.isLoading = false;
286
290
  this._canRequestImage = true;
287
291
  this._canUpdateHierarchy = true;
288
- this._needUpdateHierarchy = true;
292
+ this._needUpdateHierarchy = false;
289
293
  this._needRequestImage = false;
290
294
  }
291
295
  onResumeNativeUpdates() {
@@ -336,9 +340,10 @@ export class Img extends ImageBase {
336
340
  // this.initDrawee();
337
341
  // this.updateHierarchy();
338
342
  // }
339
- // public disposeNativeView() {
340
- // this.nativeImageViewProtected.setImageURI(null, null);
341
- // }
343
+ disposeNativeView() {
344
+ this.controllerListener = null;
345
+ // this.nativeImageViewProtected.setImageURI(null, null);
346
+ }
342
347
  updateImageUri() {
343
348
  const imagePipeLine = getImagePipeline();
344
349
  const src = this.src;
@@ -352,81 +357,72 @@ export class Img extends ImageBase {
352
357
  this.src = null;
353
358
  this.src = src;
354
359
  }
355
- [_a = ImageBase.placeholderImageUriProperty.setNative]() {
360
+ [_a = placeholderImageUriProperty.setNative]() {
356
361
  this.updateHierarchy();
357
362
  }
358
- [_b = ImageBase.failureImageUriProperty.setNative]() {
363
+ [_b = failureImageUriProperty.setNative]() {
359
364
  this.updateHierarchy();
360
365
  }
361
- [_c = ImageBase.stretchProperty.setNative]() {
366
+ [_c = stretchProperty.setNative]() {
362
367
  this.updateHierarchy();
363
368
  }
364
- [_d = ImageBase.fadeDurationProperty.setNative]() {
369
+ [_d = fadeDurationProperty.setNative]() {
365
370
  this.updateHierarchy();
366
371
  }
367
- [_e = ImageBase.backgroundUriProperty.setNative]() {
372
+ [_e = backgroundUriProperty.setNative]() {
368
373
  this.updateHierarchy();
369
374
  }
370
- [_f = ImageBase.showProgressBarProperty.setNative]() {
375
+ [_f = showProgressBarProperty.setNative]() {
371
376
  this.updateHierarchy();
372
377
  }
373
- [_g = ImageBase.progressBarColorProperty.setNative]() {
378
+ [_g = progressBarColorProperty.setNative]() {
374
379
  this.updateHierarchy();
375
380
  }
376
- [_h = ImageBase.roundAsCircleProperty.setNative]() {
381
+ [_h = roundAsCircleProperty.setNative]() {
377
382
  this.updateHierarchy();
378
383
  }
379
- [_j = ImageBase.roundTopLeftRadiusProperty.setNative]() {
384
+ [_j = roundTopLeftRadiusProperty.setNative]() {
380
385
  this.updateHierarchy();
381
386
  }
382
- [ImageBase.imageRotationProperty.setNative](value) {
387
+ [imageRotationProperty.setNative](value) {
383
388
  const scaleType = this.nativeImageViewProtected.getHierarchy().getActualImageScaleType();
384
389
  scaleType['setImageRotation']?.(value);
385
390
  this.nativeImageViewProtected.invalidate();
386
391
  }
387
- [_k = ImageBase.roundTopRightRadiusProperty.setNative]() {
392
+ [_k = roundTopRightRadiusProperty.setNative]() {
388
393
  this.updateHierarchy();
389
394
  }
390
- [_l = ImageBase.roundBottomLeftRadiusProperty.setNative]() {
395
+ [_l = roundBottomLeftRadiusProperty.setNative]() {
391
396
  this.updateHierarchy();
392
397
  }
393
- [_m = ImageBase.roundBottomRightRadiusProperty.setNative]() {
398
+ [_m = roundBottomRightRadiusProperty.setNative]() {
394
399
  this.updateHierarchy();
395
400
  }
396
- [_o = ImageBase.tintColorProperty.setNative](value) {
401
+ [_o = tintColorProperty.setNative](value) {
397
402
  this.updateHierarchy();
398
403
  }
399
- [_p = ImageBase.blurRadiusProperty.setNative]() {
404
+ [_p = blurRadiusProperty.setNative]() {
400
405
  this.initImage();
401
406
  }
402
- [_q = ImageBase.srcProperty.setNative]() {
407
+ [_q = srcProperty.setNative]() {
403
408
  this.initImage();
404
409
  }
405
- [_r = ImageBase.lowerResSrcProperty.setNative]() {
410
+ [_r = lowerResSrcProperty.setNative]() {
406
411
  this.initImage();
407
412
  }
408
- [_s = ImageBase.blurDownSamplingProperty.setNative]() {
413
+ [_s = blurDownSamplingProperty.setNative]() {
409
414
  this.initImage();
410
415
  }
411
- [_t = ImageBase.aspectRatioProperty.setNative]() {
416
+ [_t = aspectRatioProperty.setNative]() {
412
417
  this.initImage();
413
418
  }
414
- // [ImageBase.blendingModeProperty.setNative](value: string) {
415
- // console.log('blendingModeProperty', value);
416
- // switch (value) {
417
- // case 'multiply':
418
- // (this.nativeImageViewProtected as any).setXfermode(android.graphics.PorterDuff.Mode.MULTIPLY);
419
- // break;
420
- // case 'lighten':
421
- // (this.nativeImageViewProtected as any).setXfermode(android.graphics.PorterDuff.Mode.LIGHTEN);
422
- // break;
423
- // }
424
- // }
425
- // private initDrawee() {
426
- // this.initImage();
427
- // }
419
+ [backgroundInternalProperty.setNative](value) {
420
+ super[backgroundInternalProperty.setNative](value);
421
+ this.nativeViewProtected.setClipToOutline(value?.hasBorderRadius());
422
+ }
428
423
  async initImage() {
429
- if (this.nativeImageViewProtected) {
424
+ const view = this.nativeViewProtected;
425
+ if (view) {
430
426
  // this.nativeImageViewProtected.setImageURI(null);
431
427
  const src = this.src;
432
428
  if (src instanceof Promise) {
@@ -455,174 +451,161 @@ export class Img extends ImageBase {
455
451
  }
456
452
  const uri = getUri(src);
457
453
  if (!uri) {
458
- console.log(`Error: 'src' not valid: ${src}`);
454
+ console.error(`Error: 'src' not valid: ${src}`);
459
455
  return;
460
456
  }
461
457
  if (this.noCache) {
462
- const imagePipeLine = getImagePipeline();
463
- const isInCache = imagePipeLine.isInBitmapMemoryCache(uri) || imagePipeLine.isInDiskCache(uri);
464
- if (isInCache) {
465
- imagePipeLine.evictFromCache(uri);
466
- }
458
+ // testing if is in cache is slow so lets remove without testing
459
+ // const imagePipeLine = getImagePipeline();
460
+ // const isInCache = imagePipeLine.isInBitmapMemoryCache(uri) || imagePipeLine.isInDiskCache(uri);
461
+ // if (isInCache) {
462
+ getImagePipeline().evictFromCache(uri);
463
+ // }
467
464
  }
468
465
  this.isLoading = true;
469
- // const progressiveRenderingEnabledValue = this.progressiveRenderingEnabled !== undefined ? this.progressiveRenderingEnabled : false;
470
- let requestBuilder = com.facebook.imagepipeline.request.ImageRequestBuilder.newBuilderWithSource(uri).setRotationOptions(com.facebook.imagepipeline.common.RotationOptions.autoRotate());
471
- if (this.progressiveRenderingEnabled === true) {
472
- requestBuilder = requestBuilder.setProgressiveRenderingEnabled(this.progressiveRenderingEnabled);
473
- }
474
- if (this.localThumbnailPreviewsEnabled === true) {
475
- requestBuilder = requestBuilder.setLocalThumbnailPreviewsEnabled(this.localThumbnailPreviewsEnabled);
476
- }
477
- if (this.decodeWidth && this.decodeHeight) {
478
- requestBuilder = requestBuilder.setResizeOptions(new com.facebook.imagepipeline.common.ResizeOptions(this.decodeWidth, this.decodeHeight));
479
- }
480
- if (this.blurRadius) {
481
- const postProcessor = new com.nativescript.image.ScalingBlurPostprocessor(2, this.blurRadius, this.blurDownSampling || 1);
482
- requestBuilder = requestBuilder.setPostprocessor(postProcessor);
483
- }
484
- const request = requestBuilder.build();
485
- const that = new WeakRef(this);
486
- const listener = new com.facebook.drawee.controller.ControllerListener({
487
- onFinalImageSet(id, imageInfo, animatable) {
488
- if (Trace.isEnabled()) {
489
- CLog(CLogTypes.info, 'onFinalImageSet', id, imageInfo, animatable);
490
- }
491
- const nativeView = that && that.get();
492
- if (nativeView) {
493
- nativeView.updateViewSize(imageInfo);
494
- nativeView.isLoading = false;
495
- const info = new ImageInfo(imageInfo);
496
- const args = {
497
- eventName: ImageBase.finalImageSetEvent,
498
- object: nativeView,
499
- imageInfo: info,
500
- animatable: animatable
501
- };
502
- nativeView.notify(args);
503
- }
504
- else {
505
- console.log("Warning: WeakRef<Image> was GC and no '" + ImageBase.finalImageSetEvent + "' callback will be raised.");
506
- }
507
- },
508
- onFailure(id, throwable) {
509
- if (Trace.isEnabled()) {
510
- CLog(CLogTypes.info, 'onFailure', id, throwable.getLocalizedMessage());
511
- }
512
- const nativeView = that && that.get();
513
- if (nativeView) {
514
- // const nView = nativeView.nativeViewProtected;
515
- nativeView.isLoading = false;
516
- const imageError = new ImageError(throwable);
517
- const args = {
518
- eventName: ImageBase.failureEvent,
519
- object: nativeView,
520
- error: imageError
521
- };
522
- that.get().notify(args);
523
- }
524
- else {
525
- console.log("Warning: WeakRef<Image> was GC and no '" + ImageBase.failureEvent + "' callback will be raised.");
526
- }
527
- },
528
- onIntermediateImageFailed(id, throwable) {
529
- if (Trace.isEnabled()) {
530
- CLog(CLogTypes.info, 'onIntermediateImageFailed', id, throwable);
531
- }
532
- const nativeView = that && that.get();
533
- if (nativeView) {
534
- const imageError = new ImageError(throwable);
535
- const args = {
536
- eventName: ImageBase.intermediateImageFailedEvent,
537
- object: nativeView,
538
- error: imageError
539
- };
540
- that.get().notify(args);
541
- }
542
- else {
543
- console.log("Warning: WeakRef<Image> was GC and no '" + ImageBase.intermediateImageFailedEvent + "' callback will be raised.");
544
- }
545
- },
546
- onIntermediateImageSet(id, imageInfo) {
547
- if (Trace.isEnabled()) {
548
- CLog(CLogTypes.info, 'onIntermediateImageSet', id, imageInfo);
549
- }
550
- const nativeView = that && that.get();
551
- if (nativeView) {
552
- nativeView.updateViewSize(imageInfo);
553
- const info = new ImageInfo(imageInfo);
554
- const args = {
555
- eventName: ImageBase.intermediateImageSetEvent,
556
- object: nativeView,
557
- imageInfo: info
558
- };
559
- that.get().notify(args);
560
- }
561
- else {
562
- console.log("Warning: WeakRef<Image> was GC and no '" + ImageBase.intermediateImageSetEvent + "' callback will be raised.");
563
- }
564
- },
565
- onRelease(id) {
566
- if (Trace.isEnabled()) {
567
- CLog(CLogTypes.info, 'onRelease', id);
568
- }
569
- const nativeView = that && that.get();
570
- if (nativeView) {
571
- const args = {
572
- eventName: ImageBase.releaseEvent,
573
- object: nativeView
574
- };
575
- that.get().notify(args);
576
- }
577
- else {
578
- console.log("Warning: WeakRef<Image> was GC and no '" + ImageBase.releaseEvent + "' callback will be raised.");
579
- }
580
- },
581
- onSubmit(id, callerContext) {
582
- if (Trace.isEnabled()) {
583
- CLog(CLogTypes.info, 'onSubmit', id, callerContext);
584
- }
585
- const nativeView = that && that.get();
586
- if (nativeView) {
587
- const args = {
588
- eventName: ImageBase.submitEvent,
589
- object: nativeView
590
- };
591
- that.get().notify(args);
592
- }
593
- else {
594
- console.log("Warning: WeakRef<Image> was GC and no 'submitEvent' callback will be raised.");
466
+ if (!this.controllerListener) {
467
+ const that = new WeakRef(this);
468
+ this.controllerListener = new com.facebook.drawee.controller.ControllerListener({
469
+ onFinalImageSet(id, imageInfo, animatable) {
470
+ if (Trace.isEnabled()) {
471
+ CLog(CLogTypes.info, 'onFinalImageSet', id, imageInfo, animatable);
472
+ }
473
+ const nativeView = that?.get();
474
+ if (nativeView) {
475
+ nativeView.updateViewSize(imageInfo);
476
+ nativeView.isLoading = false;
477
+ const eventName = ImageBase.finalImageSetEvent;
478
+ if (nativeView.hasListeners(eventName)) {
479
+ const info = new ImageInfo(imageInfo);
480
+ nativeView.notify({
481
+ eventName,
482
+ imageInfo: info,
483
+ animatable: animatable
484
+ });
485
+ }
486
+ }
487
+ },
488
+ onFailure(id, throwable) {
489
+ if (Trace.isEnabled()) {
490
+ CLog(CLogTypes.info, 'onFailure', id, throwable.getLocalizedMessage());
491
+ }
492
+ const nativeView = that?.get();
493
+ if (nativeView) {
494
+ // const nView = nativeView.nativeViewProtected;
495
+ nativeView.isLoading = false;
496
+ const eventName = ImageBase.failureEvent;
497
+ if (nativeView.hasListeners(eventName)) {
498
+ const imageError = new ImageError(throwable);
499
+ nativeView.notify({
500
+ eventName,
501
+ error: imageError
502
+ });
503
+ }
504
+ }
505
+ },
506
+ onIntermediateImageFailed(id, throwable) {
507
+ if (Trace.isEnabled()) {
508
+ CLog(CLogTypes.info, 'onIntermediateImageFailed', id, throwable);
509
+ }
510
+ const nativeView = that?.get();
511
+ if (nativeView) {
512
+ const eventName = ImageBase.intermediateImageFailedEvent;
513
+ if (nativeView.hasListeners(eventName)) {
514
+ const imageError = new ImageError(throwable);
515
+ nativeView.notify({
516
+ eventName,
517
+ error: imageError
518
+ });
519
+ }
520
+ }
521
+ },
522
+ onIntermediateImageSet(id, imageInfo) {
523
+ if (Trace.isEnabled()) {
524
+ CLog(CLogTypes.info, 'onIntermediateImageSet', id, imageInfo);
525
+ }
526
+ const nativeView = that?.get();
527
+ if (nativeView) {
528
+ nativeView.updateViewSize(imageInfo);
529
+ const eventName = ImageBase.intermediateImageSetEvent;
530
+ if (nativeView.hasListeners(eventName)) {
531
+ const info = new ImageInfo(imageInfo);
532
+ nativeView.notify({
533
+ eventName,
534
+ imageInfo: info
535
+ });
536
+ }
537
+ }
538
+ },
539
+ onRelease(id) {
540
+ if (Trace.isEnabled()) {
541
+ CLog(CLogTypes.info, 'onRelease', id);
542
+ }
543
+ const nativeView = that?.get();
544
+ if (nativeView) {
545
+ const eventName = ImageBase.releaseEvent;
546
+ if (nativeView.hasListeners(eventName)) {
547
+ nativeView.notify({
548
+ eventName
549
+ });
550
+ }
551
+ }
552
+ },
553
+ onSubmit(id, callerContext) {
554
+ if (Trace.isEnabled()) {
555
+ CLog(CLogTypes.info, 'onSubmit', id, callerContext);
556
+ }
557
+ const nativeView = that?.get();
558
+ const eventName = ImageBase.submitEvent;
559
+ if (nativeView?.hasListeners(eventName)) {
560
+ nativeView.notify({
561
+ eventName
562
+ });
563
+ }
595
564
  }
596
- }
565
+ });
566
+ }
567
+ const options = JSON.stringify({
568
+ progressiveRenderingEnabled: this.blurRadius,
569
+ localThumbnailPreviewsEnabled: this.blurRadius,
570
+ decodeWidth: this.decodeWidth,
571
+ decodeHeight: this.decodeHeight,
572
+ blurRadius: this.blurRadius,
573
+ lowerResSrc: this.lowerResSrc ? getUri(this.lowerResSrc, false) : undefined,
574
+ blurDownSampling: this.blurDownSampling,
575
+ autoPlayAnimations: this.autoPlayAnimations,
576
+ tapToRetryEnabled: this.tapToRetryEnabled
597
577
  });
578
+ view.setUri(uri, options, this.controllerListener);
598
579
  // const async = this.loadMode === 'async';
599
580
  // if (async) {
600
- const builder = com.facebook.drawee.backends.pipeline.Fresco.newDraweeControllerBuilder();
601
- builder.setImageRequest(request);
602
- builder.setCallerContext(src);
603
- builder.setControllerListener(listener);
604
- builder.setOldController(this.nativeImageViewProtected.getController());
605
- if (Trace.isEnabled()) {
606
- builder.setPerfDataListener(new com.facebook.drawee.backends.pipeline.info.ImagePerfDataListener({
607
- onImageLoadStatusUpdated(param0, param1) {
608
- CLog(CLogTypes.info, 'onImageLoadStatusUpdated', param0, param1);
609
- },
610
- onImageVisibilityUpdated(param0, param1) {
611
- CLog(CLogTypes.info, 'onImageVisibilityUpdated', param0, param1);
612
- }
613
- }));
614
- }
615
- if (this.lowerResSrc) {
616
- builder.setLowResImageRequest(com.facebook.imagepipeline.request.ImageRequest.fromUri(getUri(this.lowerResSrc)));
617
- }
618
- if (this.autoPlayAnimations) {
619
- builder.setAutoPlayAnimations(this.autoPlayAnimations);
620
- }
621
- if (this.tapToRetryEnabled) {
622
- builder.setTapToRetryEnabled(this.tapToRetryEnabled);
623
- }
624
- const controller = builder.build();
625
- this.nativeImageViewProtected.setController(controller);
581
+ // const builder = com.facebook.drawee.backends.pipeline.Fresco.newDraweeControllerBuilder();
582
+ // builder.setImageRequest(request);
583
+ // builder.setCallerContext(src);
584
+ // builder.setControllerListener(listener);
585
+ // builder.setOldController(this.nativeImageViewProtected.getController());
586
+ // if (Trace.isEnabled()) {
587
+ // builder.setPerfDataListener(
588
+ // new com.facebook.drawee.backends.pipeline.info.ImagePerfDataListener({
589
+ // onImageLoadStatusUpdated(param0: com.facebook.drawee.backends.pipeline.info.ImagePerfData, param1: number) {
590
+ // CLog(CLogTypes.info, 'onImageLoadStatusUpdated', param0, param1);
591
+ // },
592
+ // onImageVisibilityUpdated(param0: com.facebook.drawee.backends.pipeline.info.ImagePerfData, param1: number) {
593
+ // CLog(CLogTypes.info, 'onImageVisibilityUpdated', param0, param1);
594
+ // }
595
+ // })
596
+ // );
597
+ // }
598
+ // if (this.lowerResSrc) {
599
+ // builder.setLowResImageRequest(com.facebook.imagepipeline.request.ImageRequest.fromUri(getUri(this.lowerResSrc)));
600
+ // }
601
+ // if (this.autoPlayAnimations) {
602
+ // builder.setAutoPlayAnimations(this.autoPlayAnimations);
603
+ // }
604
+ // if (this.tapToRetryEnabled) {
605
+ // builder.setTapToRetryEnabled(this.tapToRetryEnabled);
606
+ // }
607
+ // const controller = builder.build();
608
+ // this.nativeImageViewProtected.setController(controller);
626
609
  // } else {
627
610
  // const dataSource = com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline().fetchDecodedImage(request, src);
628
611
  // const result = com.facebook.datasource.DataSources.waitForFinalResult(dataSource);
@@ -668,12 +651,7 @@ export class Img extends ImageBase {
668
651
  if (this.stretch) {
669
652
  builder.setActualImageScaleType(this.stretch, this.imageRotation);
670
653
  }
671
- if (this.fadeDuration) {
672
- builder.setFadeDuration(this.fadeDuration);
673
- }
674
- else {
675
- builder.setFadeDuration(0);
676
- }
654
+ builder.setFadeDuration(this.fadeDuration || 0);
677
655
  if (this.backgroundUri && backgroundDrawable) {
678
656
  builder.setBackground(backgroundDrawable);
679
657
  }
@@ -683,15 +661,14 @@ export class Img extends ImageBase {
683
661
  if (this.roundAsCircle) {
684
662
  builder.setRoundingParamsAsCircle();
685
663
  }
686
- if (this.roundBottomLeftRadius || this.roundBottomRightRadius || this.roundTopLeftRadius || this.roundTopRightRadius) {
687
- const topLeftRadius = this.roundTopLeftRadius || 0;
688
- const topRightRadius = this.roundTopRightRadius || 0;
689
- const bottomRightRadius = this.roundBottomRightRadius || 0;
690
- const bottomLeftRadius = this.roundBottomLeftRadius || 0;
664
+ const topLeftRadius = this.roundTopLeftRadius || 0;
665
+ const topRightRadius = this.roundTopRightRadius || 0;
666
+ const bottomRightRadius = this.roundBottomRightRadius || 0;
667
+ const bottomLeftRadius = this.roundBottomLeftRadius || 0;
668
+ if (topLeftRadius || topRightRadius || bottomRightRadius || bottomLeftRadius) {
691
669
  builder.setCornersRadii(topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius);
692
670
  }
693
- const hierarchy = builder.build();
694
- this.nativeImageViewProtected.setHierarchy(hierarchy);
671
+ this.nativeImageViewProtected.setHierarchy(builder.build());
695
672
  }
696
673
  }
697
674
  getDrawable(path) {
package/index.ios.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from './index-common';
2
2
  import { ImageAsset, ImageSource, Screen, Trace, Utils, knownFolders, path } from '@nativescript/core';
3
- import { isString } from '@nativescript/core/utils/types';
4
- import { CLog, CLogTypes, EventData, ImageBase, ScaleType } from './index-common';
5
3
  import { layout } from '@nativescript/core/utils/layout-helper';
4
+ import { isString } from '@nativescript/core/utils/types';
5
+ import { CLog, CLogTypes, EventData, ImageBase, ScaleType, failureImageUriProperty, placeholderImageUriProperty, srcProperty, stretchProperty } from './index-common';
6
6
  export class ImageInfo {
7
7
  constructor(width, height) {
8
8
  this.width = width;
@@ -401,17 +401,17 @@ export class Img extends ImageBase {
401
401
  }
402
402
  }
403
403
  }
404
- [ImageBase.srcProperty.setNative](value) {
404
+ [srcProperty.setNative](value) {
405
405
  this.initImage();
406
406
  }
407
- [ImageBase.placeholderImageUriProperty.setNative]() {
407
+ [placeholderImageUriProperty.setNative]() {
408
408
  this.placeholderImage = this.getUIImage(this.placeholderImageUri);
409
409
  this.initImage();
410
410
  }
411
- [ImageBase.failureImageUriProperty.setNative]() {
411
+ [failureImageUriProperty.setNative]() {
412
412
  // this.updateHierarchy();
413
413
  }
414
- [ImageBase.stretchProperty.setNative](value) {
414
+ [stretchProperty.setNative](value) {
415
415
  if (!this.nativeView) {
416
416
  return;
417
417
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.10",
3
+ "version": "4.3.12",
4
4
  "description": "Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.",
5
5
  "main": "./index",
6
6
  "sideEffects": false,
@@ -44,5 +44,5 @@
44
44
  },
45
45
  "license": "Apache-2.0",
46
46
  "readmeFilename": "README.md",
47
- "gitHead": "1293779cf0c26f19c40694c88d4da85d92fbe2e2"
47
+ "gitHead": "9ea31cb0967917f14880e3928043f74497f59b88"
48
48
  }
@@ -9,6 +9,7 @@ dependencies {
9
9
  implementation("com.facebook.fresco:imagepipeline-okhttp3:$frescoVersion") {
10
10
  exclude group: 'com.facebook.soloader', module: 'soloader'
11
11
  }
12
+ implementation("com.facebook.fresco:nativeimagetranscoder:$frescoVersion")
12
13
  implementation 'com.facebook.infer.annotation:infer-annotation:0.18.0'
13
14
  // implementation ("com.facebook.fresco:animated-gif:$frescoVersion") {
14
15
  // exclude group: 'com.facebook.soloader', module: 'soloader'