@@ -368,15 +368,16 @@ export class Label extends LabelBase {
368368 return inset ;
369369 }
370370
371- _requestLayoutOnTextChanged ( ) : void {
371+ _requestLayoutOnTextChanged ( ) {
372372 if ( this . mFixedSize === FixedSize . BOTH ) {
373- return ;
373+ return false ;
374374 }
375375 if ( this . mFixedSize === FixedSize . WIDTH && ! this . textWrap && this . getMeasuredHeight ( ) > 0 ) {
376376 // Single line label with fixed width will skip request layout on text change.
377- return ;
377+ return false ;
378378 }
379379 super . _requestLayoutOnTextChanged ( ) ;
380+ return true ;
380381 }
381382
382383 private _measureNativeView (
@@ -414,6 +415,11 @@ export class Label extends LabelBase {
414415
415416 const height = Utils . layout . getMeasureSpecSize ( heightMeasureSpec ) ;
416417 const heightMode = Utils . layout . getMeasureSpecMode ( heightMeasureSpec ) ;
418+
419+ this . mFixedSize =
420+ ( widthMode === Utils . layout . EXACTLY ? FixedSize . WIDTH : FixedSize . NONE ) |
421+ ( heightMode === Utils . layout . EXACTLY ? FixedSize . HEIGHT : FixedSize . NONE ) ;
422+
417423 let resetFont ;
418424 // reset insent or it will taken into account for measurement
419425 if ( this . autoFontSize ) {
@@ -727,11 +733,10 @@ export class Label extends LabelBase {
727733 }
728734 // no need to update veticalAlignment or autoSize as we ask for a layout
729735 // will be done in onMeasure and onLayout
730- // this.updateVerticalAlignment();
731- // if (this.autoFontSize) {
732- // this.updateAutoFontSize({ textView: this.nativeTextViewProtected, force: true });
733- // }
734- this . _requestLayoutOnTextChanged ( ) ;
736+
737+ if ( ! this . _requestLayoutOnTextChanged ( ) && this . autoFontSize ) {
738+ this . updateAutoFontSize ( { textView : this . nativeTextViewProtected , force : true } ) ;
739+ }
735740 }
736741
737742 setTextDecorationAndTransform ( ) {
@@ -917,8 +922,8 @@ export class Label extends LabelBase {
917922 return currentFont ;
918923 }
919924 const textViewSize = NSLabelUtils . insetWithRectUIEdgeInsets ( textView . bounds , textView . padding ) . size ;
920- const fixedWidth = Math . floor ( width !== undefined ? width : textViewSize . width ) ;
921- const fixedHeight = Math . floor ( height !== undefined ? height : textViewSize . height ) ;
925+ const fixedWidth = Math . ceil ( width !== undefined ? width : textViewSize . width ) ;
926+ const fixedHeight = Math . ceil ( height !== undefined ? height : textViewSize . height ) ;
922927 if ( fixedWidth === 0 || fixedHeight === 0 ) {
923928 return currentFont ;
924929 }
@@ -992,8 +997,9 @@ export class Label extends LabelBase {
992997 if ( ! onlyMeasure ) {
993998 this . fontSizeRatio = expectFont . pointSize / fontSize ;
994999 }
995-
996- this . updateVerticalAlignment ( ) ;
1000+ if ( ! onlyMeasure ) {
1001+ this . updateVerticalAlignment ( ) ;
1002+ }
9971003 }
9981004 return currentFont ;
9991005 }
0 commit comments