@@ -291,39 +291,49 @@ export class TextBase extends TextBaseCommon {
291
291
this . nativeTextViewProtected . textColor = color ;
292
292
}
293
293
}
294
+ _animationWrap ( fn : ( ) => void ) {
295
+ const shouldAnimate = this . iosTextAnimation === 'inherit' ? TextBase . iosTextAnimationFallback : this . iosTextAnimation ;
296
+ if ( shouldAnimate ) {
297
+ fn ( ) ;
298
+ } else {
299
+ UIView . performWithoutAnimation ( fn ) ;
300
+ }
301
+ }
294
302
295
303
_setNativeText ( reset = false ) : void {
296
- if ( reset ) {
297
- const nativeView = this . nativeTextViewProtected ;
298
- if ( nativeView instanceof UIButton ) {
299
- // Clear attributedText or title won't be affected.
300
- nativeView . setAttributedTitleForState ( null , UIControlState . Normal ) ;
301
- nativeView . setTitleForState ( null , UIControlState . Normal ) ;
302
- } else {
303
- // Clear attributedText or text won't be affected.
304
- nativeView . attributedText = null ;
305
- nativeView . text = null ;
306
- }
304
+ this . _animationWrap ( ( ) => {
305
+ if ( reset ) {
306
+ const nativeView = this . nativeTextViewProtected ;
307
+ if ( nativeView instanceof UIButton ) {
308
+ // Clear attributedText or title won't be affected.
309
+ nativeView . setAttributedTitleForState ( null , UIControlState . Normal ) ;
310
+ nativeView . setTitleForState ( null , UIControlState . Normal ) ;
311
+ } else {
312
+ // Clear attributedText or text won't be affected.
313
+ nativeView . attributedText = null ;
314
+ nativeView . text = null ;
315
+ }
307
316
308
- return ;
309
- }
317
+ return ;
318
+ }
310
319
311
- const letterSpacing = this . style . letterSpacing ? this . style . letterSpacing : 0 ;
312
- const lineHeight = this . style . lineHeight ? this . style . lineHeight : 0 ;
313
- if ( this . formattedText ) {
314
- this . nativeTextViewProtected . nativeScriptSetFormattedTextDecorationAndTransformLetterSpacingLineHeight ( this . getFormattedStringDetails ( this . formattedText ) as any , letterSpacing , lineHeight ) ;
315
- } else {
316
- // console.log('setTextDecorationAndTransform...')
317
- const text = getTransformedText ( isNullOrUndefined ( this . text ) ? '' : `${ this . text } ` , this . textTransform ) ;
318
- this . nativeTextViewProtected . nativeScriptSetTextDecorationAndTransformTextDecorationLetterSpacingLineHeight ( text , this . style . textDecoration || '' , letterSpacing , lineHeight ) ;
320
+ const letterSpacing = this . style . letterSpacing ? this . style . letterSpacing : 0 ;
321
+ const lineHeight = this . style . lineHeight ? this . style . lineHeight : 0 ;
322
+ if ( this . formattedText ) {
323
+ this . nativeTextViewProtected . nativeScriptSetFormattedTextDecorationAndTransformLetterSpacingLineHeight ( this . getFormattedStringDetails ( this . formattedText ) as any , letterSpacing , lineHeight ) ;
324
+ } else {
325
+ // console.log('setTextDecorationAndTransform...')
326
+ const text = getTransformedText ( isNullOrUndefined ( this . text ) ? '' : `${ this . text } ` , this . textTransform ) ;
327
+ this . nativeTextViewProtected . nativeScriptSetTextDecorationAndTransformTextDecorationLetterSpacingLineHeight ( text , this . style . textDecoration || '' , letterSpacing , lineHeight ) ;
319
328
320
- if ( ! this . style ?. color && majorVersion >= 13 && UIColor . labelColor ) {
321
- this . _setColor ( UIColor . labelColor ) ;
329
+ if ( ! this . style ?. color && majorVersion >= 13 && UIColor . labelColor ) {
330
+ this . _setColor ( UIColor . labelColor ) ;
331
+ }
322
332
}
323
- }
324
- if ( this . style ? .textStroke ) {
325
- this . nativeTextViewProtected . nativeScriptSetFormattedTextStrokeColor ( Length . toDevicePixels ( this . style . textStroke . width , 0 ) , this . style . textStroke . color . ios ) ;
326
- }
333
+ if ( this . style ?. textStroke ) {
334
+ this . nativeTextViewProtected . nativeScriptSetFormattedTextStrokeColor ( Length . toDevicePixels ( this . style . textStroke . width , 0 ) , this . style . textStroke . color . ios ) ;
335
+ }
336
+ } ) ;
327
337
}
328
338
329
339
createFormattedTextNative ( value : FormattedString ) {
0 commit comments