@@ -127,13 +127,14 @@ abstract class LabelBase extends View implements LabelViewDefinition {
127
127
@cssProperty paddingLeft : CoreTypes . LengthType ;
128
128
129
129
// for now code is duplicated as Android version is a full rewrite
130
- mCanChangeText = true ;
130
+ mInResumeNativeUpdates = false ;
131
131
mNeedSetText = false ;
132
+ mNeedSetAutoSize = false ;
132
133
public onResumeNativeUpdates ( ) : void {
133
134
// {N} suspends properties update on `_suspendNativeUpdates`. So we only need to do this in onResumeNativeUpdates
134
- this . mCanChangeText = false ;
135
+ this . mInResumeNativeUpdates = true ;
135
136
super . onResumeNativeUpdates ( ) ;
136
- this . mCanChangeText = true ;
137
+ this . mInResumeNativeUpdates = false ;
137
138
if ( this . mNeedSetText ) {
138
139
this . mNeedSetText = false ;
139
140
this . _setNativeText ( ) ;
@@ -355,21 +356,39 @@ export class Label extends LabelBase {
355
356
Length . toDevicePixels ( value , 0 ) + Length . toDevicePixels ( this . style . borderLeftWidth , 0 )
356
357
) ;
357
358
}
358
- [ maxFontSizeProperty . setNative ] ( value ) {
359
- if ( this . mAutoFontSize ) {
360
- this . enableAutoSize ( ) ;
359
+
360
+ // for now code is duplicated as Android version is a full rewrite
361
+ mNeedSetAutoSize = false ;
362
+ public onResumeNativeUpdates ( ) : void {
363
+ super . onResumeNativeUpdates ( ) ;
364
+ if ( this . mNeedSetAutoSize ) {
365
+ this . mNeedSetAutoSize = false ;
366
+ if ( this . autoFontSize ) {
367
+ this . enableAutoSize ( ) ;
368
+ } else {
369
+ this . disableAutoSize ( ) ;
370
+ }
361
371
}
362
372
}
373
+ [ maxFontSizeProperty . setNative ] ( value ) {
374
+ this . enableAutoSize ( ) ;
375
+ }
363
376
[ minFontSizeProperty . setNative ] ( value ) {
364
- if ( this . mAutoFontSize ) {
365
- this . enableAutoSize ( ) ;
366
- }
377
+ this . enableAutoSize ( ) ;
367
378
}
368
379
369
380
protected enableAutoSize ( ) {
381
+ if ( this . mInResumeNativeUpdates ) {
382
+ this . mNeedSetAutoSize = true ;
383
+ return ;
384
+ }
370
385
this . nativeViewProtected . enableAutoSize ( this . minFontSize || 10 , this . maxFontSize || 200 , this . autoFontSizeStep || 1 ) ;
371
386
}
372
387
protected disableAutoSize ( ) {
388
+ if ( this . mInResumeNativeUpdates ) {
389
+ this . mNeedSetAutoSize = true ;
390
+ return ;
391
+ }
373
392
this . nativeViewProtected . disableAutoSize ( ) ;
374
393
}
375
394
[ autoFontSizeProperty . setNative ] ( value : boolean ) {
@@ -434,7 +453,7 @@ export class Label extends LabelBase {
434
453
435
454
@profile
436
455
_setNativeText ( reset : boolean = false ) : void {
437
- if ( ! this . mCanChangeText ) {
456
+ if ( this . mInResumeNativeUpdates ) {
438
457
this . mNeedSetText = true ;
439
458
return ;
440
459
}
0 commit comments