Skip to content

Commit fb6d15e

Browse files
committed
fix(android): ensure stretch and imageRotation are updated correctly on change
1 parent f9f4cef commit fb6d15e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/image/index.android.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ export class Img extends ImageBase {
490490
[roundTopLeftRadiusProperty.setNative]() {
491491
this.updateHierarchy();
492492
}
493+
@needUpdateHierarchy
493494
[imageRotationProperty.setNative](value) {
494495
const scaleType = this.nativeImageViewProtected.getHierarchy().getActualImageScaleType();
495496
scaleType['setImageRotation']?.(value);
@@ -829,6 +830,9 @@ export class Img extends ImageBase {
829830
}
830831

831832
this.nativeImageViewProtected.setHierarchy(builder.build());
833+
if (!this._needRequestImage) {
834+
this.nativeImageViewProtected.setController(this.nativeImageViewProtected.getController());
835+
}
832836
}
833837
}
834838

@@ -942,12 +946,12 @@ class GenericDraweeHierarchyBuilder {
942946
return this;
943947
}
944948

945-
public setActualImageScaleType(scaleType: ScaleType, imageRotation): GenericDraweeHierarchyBuilder {
949+
public setActualImageScaleType(scaleType: ScaleType, imageRotation = 0): GenericDraweeHierarchyBuilder {
946950
if (!this.nativeBuilder) {
947951
return this;
948952
}
949953
const nativeScaleType = getScaleType(scaleType);
950-
if (nativeScaleType['setImageRotation']) {
954+
if (imageRotation !== 0 && nativeScaleType['setImageRotation']) {
951955
nativeScaleType['setImageRotation'](imageRotation);
952956
}
953957
this.nativeBuilder.setActualImageScaleType(nativeScaleType);

0 commit comments

Comments
 (0)