Skip to content

Commit d0564ea

Browse files
committed
fix(ios): autoFontSize not omputed
1 parent bdbf7cc commit d0564ea

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: src/label.ios.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,16 @@ export class Label extends LabelBase {
412412
const height = layout.getMeasureSpecSize(heightMeasureSpec);
413413
const heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
414414
if (this.autoFontSize) {
415-
// this.needsAutoFontSize = true;
416-
this.textViewDidChange(
417-
nativeView,
418-
layout.toDeviceIndependentPixels(width),
419-
layout.toDeviceIndependentPixels(height)
420-
);
415+
const finiteWidth: boolean = widthMode === layout.EXACTLY;
416+
const finiteHeight: boolean = heightMode === layout.EXACTLY;
417+
if (!finiteWidth || !finiteHeight) {
418+
this.needsAutoFontSize = true;
419+
this.textViewDidChange(
420+
nativeView,
421+
layout.toDeviceIndependentPixels(width),
422+
layout.toDeviceIndependentPixels(height)
423+
);
424+
}
421425
}
422426

423427
const desiredSize = layout.measureNativeView(nativeView, width, widthMode, height, heightMode);

0 commit comments

Comments
 (0)