Skip to content

Commit 63c7b5f

Browse files
committed
chore: cleanup decorators
1 parent eedeec8 commit 63c7b5f

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

src/image.android.ts

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,7 @@ export class FailureEventData extends EventData {
311311
}
312312
}
313313

314-
export const needUpdateHierarchy = function (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) {
315-
const originalMethod = descriptor.value;
316-
descriptor.value = function (...args: any[]) {
317-
if (!this._canUpdateHierarchy) {
318-
this._needUpdateHierarchy = true;
319-
return;
320-
}
321-
return originalMethod.apply(this, args);
322-
};
323-
};
314+
324315
export const needRequestImage = function (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) {
325316
const originalMethod = descriptor.value;
326317
descriptor.value = function (...args: any[]) {
@@ -403,72 +394,58 @@ export class Img extends ImageBase {
403394
this.src = src;
404395
}
405396

406-
@needUpdateHierarchy
407397
[ImageBase.placeholderImageUriProperty.setNative]() {
408398
this.updateHierarchy();
409399
}
410400

411-
@needUpdateHierarchy
412401
[ImageBase.failureImageUriProperty.setNative]() {
413402
this.updateHierarchy();
414403
}
415404

416-
@needUpdateHierarchy
417405
[ImageBase.stretchProperty.setNative]() {
418406
this.updateHierarchy();
419407
}
420408

421-
@needUpdateHierarchy
422409
[ImageBase.fadeDurationProperty.setNative]() {
423410
this.updateHierarchy();
424411
}
425412

426-
@needUpdateHierarchy
427413
[ImageBase.backgroundUriProperty.setNative]() {
428414
this.updateHierarchy();
429415
}
430416

431-
@needUpdateHierarchy
432417
[ImageBase.showProgressBarProperty.setNative]() {
433418
this.updateHierarchy();
434419
}
435420

436-
@needUpdateHierarchy
437421
[ImageBase.progressBarColorProperty.setNative]() {
438422
this.updateHierarchy();
439423
}
440424

441-
@needUpdateHierarchy
442425
[ImageBase.roundAsCircleProperty.setNative]() {
443426
this.updateHierarchy();
444427
}
445428

446-
@needUpdateHierarchy
447429
[ImageBase.roundTopLeftProperty.setNative]() {
448430
this.updateHierarchy();
449431
}
450432

451-
@needUpdateHierarchy
452433
[ImageBase.roundTopRightProperty.setNative]() {
453434
this.updateHierarchy();
454435
}
455436

456-
@needUpdateHierarchy
457437
[ImageBase.roundBottomLeftProperty.setNative]() {
458438
this.updateHierarchy();
459439
}
460440

461-
@needUpdateHierarchy
462441
[ImageBase.roundBottomRightProperty.setNative]() {
463442
this.updateHierarchy();
464443
}
465444

466-
@needUpdateHierarchy
467445
[ImageBase.roundedCornerRadiusProperty.setNative]() {
468446
this.updateHierarchy();
469447
}
470448

471-
@needUpdateHierarchy
472449
[ImageBase.tintColorProperty.setNative](value: Color) {
473450
this.updateHierarchy();
474451
}
@@ -722,6 +699,10 @@ export class Img extends ImageBase {
722699
}
723700

724701
private updateHierarchy() {
702+
if (!this._canUpdateHierarchy) {
703+
this._needUpdateHierarchy = true;
704+
return;
705+
}
725706
if (this.nativeViewProtected) {
726707
let failureImageDrawable: android.graphics.drawable.BitmapDrawable;
727708
let placeholderImageDrawable: android.graphics.drawable.BitmapDrawable;

0 commit comments

Comments
 (0)