@nativescript-community/ui-image 4.0.30 → 4.0.34

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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.0.34](https://github.com/nativescript-community/ui-image/compare/v4.0.33...v4.0.34) (2021-10-15)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-image
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.0.33](https://github.com/nativescript-community/ui-image/compare/v4.0.32...v4.0.33) (2021-10-08)
15
+
16
+ **Note:** Version bump only for package @nativescript-community/ui-image
17
+
18
+
19
+
20
+
21
+
22
+ ## [4.0.32](https://github.com/nativescript-community/ui-image/compare/v4.0.31...v4.0.32) (2021-10-08)
23
+
24
+ **Note:** Version bump only for package @nativescript-community/ui-image
25
+
26
+
27
+
28
+
29
+
30
+ ## [4.0.31](https://github.com/nativescript-community/ui-image/compare/v4.0.30...v4.0.31) (2021-10-07)
31
+
32
+ **Note:** Version bump only for package @nativescript-community/ui-image
33
+
34
+
35
+
36
+
37
+
6
38
  ## [4.0.30](https://github.com/nativescript-community/ui-image/compare/v4.0.29...v4.0.30) (2021-10-07)
7
39
 
8
40
  **Note:** Version bump only for package @nativescript-community/ui-image
package/image.android.js CHANGED
@@ -589,7 +589,15 @@ export class Img extends ImageBase {
589
589
  getDrawable(path) {
590
590
  let drawable;
591
591
  if (typeof path === 'string') {
592
- if (isFileOrResourcePath(path)) {
592
+ if (isFontIconURI(path)) {
593
+ const fontIconCode = (path).split('//')[1];
594
+ if (fontIconCode !== undefined) {
595
+ const font = this.style.fontInternal;
596
+ const color = this.style.color;
597
+ drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
598
+ }
599
+ }
600
+ else if (isFileOrResourcePath(path)) {
593
601
  if (path.indexOf(RESOURCE_PREFIX) === 0) {
594
602
  return this.getDrawableFromResource(path);
595
603
  }
package/image.ios.d.ts CHANGED
@@ -38,7 +38,7 @@ export declare class Img extends ImageBase {
38
38
  _setNativeClipToBounds(): void;
39
39
  onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
40
40
  updateImageUri(): void;
41
- _setNativeImage(nativeImage: UIImage): void;
41
+ _setNativeImage(nativeImage: UIImage, animated?: boolean): void;
42
42
  private handleImageLoaded;
43
43
  private onLoadProgress;
44
44
  private getUIImage;
package/image.ios.js CHANGED
@@ -8,16 +8,6 @@ var SDImageRoundAsCircleTransformer = /** @class */ (function (_super) {
8
8
  function SDImageRoundAsCircleTransformer() {
9
9
  return _super !== null && _super.apply(this, arguments) || this;
10
10
  }
11
- // _cornerRadius = 20;
12
- // get cornerRadius() {
13
- // return this._cornerRadius;
14
- // }
15
- // get corners() {
16
- // return UIRectCorner.AllCorners;
17
- // }
18
- // get borderWidth() {
19
- // return 0;
20
- // }
21
11
  SDImageRoundAsCircleTransformer.transformer = function () {
22
12
  var transformer = SDImageRoundAsCircleTransformer.alloc().init();
23
13
  return transformer;
@@ -211,15 +201,9 @@ export class Img extends ImageBase {
211
201
  this._imageSourceAffectsLayout = true;
212
202
  this.handleImageLoaded = (image, error, cacheType) => {
213
203
  this.isLoading = false;
214
- if ((this.alwaysFade || cacheType !== 2) && this.fadeDuration > 0) {
215
- this.nativeViewProtected.alpha = 0.0;
216
- this._setNativeImage(image);
217
- UIView.animateWithDurationAnimations(this.fadeDuration / 1000, () => {
218
- this.nativeViewProtected.alpha = this.opacity;
219
- });
220
- }
221
- else {
222
- this._setNativeImage(image);
204
+ const animate = (this.alwaysFade || cacheType !== 2) && this.fadeDuration > 0;
205
+ if (image) {
206
+ this._setNativeImage(image, animate);
223
207
  }
224
208
  if (!this.autoPlayAnimations) {
225
209
  this.nativeViewProtected.stopAnimating();
@@ -233,9 +217,10 @@ export class Img extends ImageBase {
233
217
  this.notify(args);
234
218
  if (this.failureImageUri) {
235
219
  image = this.getUIImage(this.failureImageUri);
220
+ this._setNativeImage(image, animate);
236
221
  }
237
222
  }
238
- else {
223
+ else if (image) {
239
224
  const args = {
240
225
  eventName: ImageBase.finalImageSetEvent,
241
226
  object: this,
@@ -303,8 +288,17 @@ export class Img extends ImageBase {
303
288
  this.src = null;
304
289
  this.src = src;
305
290
  }
306
- _setNativeImage(nativeImage) {
307
- this.nativeViewProtected.image = nativeImage;
291
+ _setNativeImage(nativeImage, animated = true) {
292
+ if (animated) {
293
+ this.nativeViewProtected.alpha = 0.0;
294
+ this.nativeViewProtected.image = nativeImage;
295
+ UIView.animateWithDurationAnimations(this.fadeDuration / 1000, () => {
296
+ this.nativeViewProtected.alpha = this.opacity;
297
+ });
298
+ }
299
+ else {
300
+ this.nativeViewProtected.image = nativeImage;
301
+ }
308
302
  if (this._imageSourceAffectsLayout) {
309
303
  this._imageSourceAffectsLayout = false;
310
304
  this.requestLayout();
@@ -316,7 +310,15 @@ export class Img extends ImageBase {
316
310
  }
317
311
  let image;
318
312
  if (typeof imagePath === 'string') {
319
- if (isFileOrResourcePath(imagePath)) {
313
+ if (isFontIconURI(imagePath)) {
314
+ const fontIconCode = (imagePath).split('//')[1];
315
+ if (fontIconCode !== undefined) {
316
+ const font = this.style.fontInternal;
317
+ const color = this.style.color;
318
+ image = (ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios);
319
+ }
320
+ }
321
+ if (!image && isFileOrResourcePath(imagePath)) {
320
322
  image = ImageSource.fromFileOrResourceSync(imagePath);
321
323
  }
322
324
  }
@@ -332,8 +334,9 @@ export class Img extends ImageBase {
332
334
  if (this.nativeViewProtected) {
333
335
  const src = this.src;
334
336
  if (src) {
337
+ const animate = this.fadeDuration > 0;
335
338
  if (src instanceof ImageSource) {
336
- this._setNativeImage(src.ios);
339
+ this._setNativeImage(src.ios, animate);
337
340
  return;
338
341
  }
339
342
  else if (typeof src === 'string') {
@@ -342,7 +345,7 @@ export class Img extends ImageBase {
342
345
  if (fontIconCode !== undefined) {
343
346
  const font = this.style.fontInternal;
344
347
  const color = this.style.color;
345
- this._setNativeImage(ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios);
348
+ this._setNativeImage(ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios, animate);
346
349
  }
347
350
  return;
348
351
  }
@@ -386,6 +389,9 @@ export class Img extends ImageBase {
386
389
  }
387
390
  this.nativeViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(uri, this.placeholderImage, options, context, this.onLoadProgress, this.handleImageLoaded);
388
391
  }
392
+ else if (this.placeholderImage) {
393
+ this._setNativeImage(this.placeholderImage);
394
+ }
389
395
  else {
390
396
  this._setNativeImage(null);
391
397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.0.30",
3
+ "version": "4.0.34",
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": "./image",
6
6
  "sideEffects": false,
@@ -36,5 +36,5 @@
36
36
  },
37
37
  "license": "Apache-2.0",
38
38
  "readmeFilename": "README.md",
39
- "gitHead": "ea3233132cb196baa46253fe3ff8126bdf2f5fec"
39
+ "gitHead": "9293bf7be60719ed1f475a9d9ce71a82d873821b"
40
40
  }