Skip to content

Commit 9c4d55e

Browse files
committed
fix(ios): another fix for flexbox layout
1 parent 4de4d80 commit 9c4d55e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/label.ios.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,11 @@ export class Label extends LabelBase {
791791
return currentFont;
792792
}
793793
const autoSizeKey = fixedWidth + '_' + fixedHeight;
794-
if (!force && autoSizeKey === this._lastAutoSizeKey) {
794+
const fontSize = this.style.fontSize || 17;
795+
let expectFont = (this.style.fontInternal || Font.default).getUIFont(UIFont.systemFontOfSize(fontSize));
796+
//if we are not on the "default" font size we need to measure again or we could break
797+
//the layout behavior like for flexbox where there are multiple measure passes
798+
if (!force && autoSizeKey === this._lastAutoSizeKey && expectFont.pointSize === textView.font.pointSize) {
795799
return null;
796800
}
797801
currentFont = textView.font;
@@ -800,9 +804,6 @@ export class Label extends LabelBase {
800804
// we need to reset verticalTextAlignment or computation will be wrong
801805
this.updateTextContainerInset(false);
802806

803-
const fontSize = this.style.fontSize || 17;
804-
let expectFont: UIFont = (this.style.fontInternal || Font.default).getUIFont(UIFont.systemFontOfSize(fontSize));
805-
//first reset the font size
806807
let expectSize;
807808

808809
const stepSize = this.autoFontSizeStep || 1;
@@ -814,6 +815,7 @@ export class Label extends LabelBase {
814815
textView.font = font;
815816
}
816817
};
818+
//first reset the font size
817819
updateFontSize(expectFont);
818820
const size = () => {
819821
if (nbLines === 1) {

0 commit comments

Comments
 (0)