@@ -356,4 +356,194 @@ SharedDebugStringConvertibleList BaseTextProps::getDebugProps() const {
356
356
}
357
357
#endif
358
358
359
+ #ifdef ANDROID
360
+
361
+ static folly::dynamic toDynamic (const Size& size) {
362
+ folly::dynamic sizeResult = folly::dynamic::object ();
363
+ sizeResult[" width" ] = size.width ;
364
+ sizeResult[" height" ] = size.height ;
365
+ return sizeResult;
366
+ }
367
+
368
+ void BaseTextProps::appendTextAttributesProps (
369
+ folly::dynamic& result,
370
+ const BaseTextProps* oldProps) const {
371
+ if (textAttributes.foregroundColor !=
372
+ oldProps->textAttributes .foregroundColor ) {
373
+ result[" color" ] = *textAttributes.foregroundColor ;
374
+ }
375
+
376
+ if (textAttributes.fontFamily != oldProps->textAttributes .fontFamily ) {
377
+ result[" fontFamily" ] = textAttributes.fontFamily ;
378
+ }
379
+
380
+ if (textAttributes.fontSize != oldProps->textAttributes .fontSize ) {
381
+ result[" fontSize" ] = textAttributes.fontSize ;
382
+ }
383
+
384
+ if (textAttributes.fontSizeMultiplier !=
385
+ oldProps->textAttributes .fontSizeMultiplier ) {
386
+ result[" fontSizeMultiplier" ] = textAttributes.fontSizeMultiplier ;
387
+ }
388
+
389
+ if (textAttributes.fontWeight != oldProps->textAttributes .fontWeight ) {
390
+ result[" fontWeight" ] = textAttributes.fontWeight .has_value ()
391
+ ? toString (textAttributes.fontWeight .value ())
392
+ : nullptr ;
393
+ }
394
+
395
+ if (textAttributes.fontStyle != oldProps->textAttributes .fontStyle ) {
396
+ result[" fontStyle" ] = textAttributes.fontStyle .has_value ()
397
+ ? toString (textAttributes.fontStyle .value ())
398
+ : nullptr ;
399
+ }
400
+
401
+ if (textAttributes.fontVariant != oldProps->textAttributes .fontVariant ) {
402
+ result[" fontVariant" ] = textAttributes.fontVariant .has_value ()
403
+ ? toString (textAttributes.fontVariant .value ())
404
+ : nullptr ;
405
+ }
406
+
407
+ if (textAttributes.allowFontScaling !=
408
+ oldProps->textAttributes .allowFontScaling ) {
409
+ result[" allowFontScaling" ] = textAttributes.allowFontScaling .has_value ()
410
+ ? textAttributes.allowFontScaling .value ()
411
+ : folly::dynamic (nullptr );
412
+ }
413
+
414
+ if (textAttributes.maxFontSizeMultiplier !=
415
+ oldProps->textAttributes .maxFontSizeMultiplier ) {
416
+ result[" maxFontSizeMultiplier" ] = textAttributes.maxFontSizeMultiplier ;
417
+ }
418
+
419
+ if (textAttributes.dynamicTypeRamp !=
420
+ oldProps->textAttributes .dynamicTypeRamp ) {
421
+ result[" dynamicTypeRamp" ] = textAttributes.dynamicTypeRamp .has_value ()
422
+ ? toString (textAttributes.dynamicTypeRamp .value ())
423
+ : nullptr ;
424
+ }
425
+
426
+ if (textAttributes.letterSpacing != oldProps->textAttributes .letterSpacing ) {
427
+ result[" letterSpacing" ] = textAttributes.letterSpacing ;
428
+ }
429
+
430
+ if (textAttributes.textTransform != oldProps->textAttributes .textTransform ) {
431
+ result[" textTransform" ] = textAttributes.textTransform .has_value ()
432
+ ? toString (textAttributes.textTransform .value ())
433
+ : nullptr ;
434
+ }
435
+
436
+ if (textAttributes.textAlignVertical !=
437
+ oldProps->textAttributes .textAlignVertical ) {
438
+ result[" textAlignVertical" ] = textAttributes.textAlignVertical .has_value ()
439
+ ? toString (textAttributes.textAlignVertical .value ())
440
+ : nullptr ;
441
+ }
442
+
443
+ if (textAttributes.lineHeight != oldProps->textAttributes .lineHeight ) {
444
+ result[" lineHeight" ] = textAttributes.lineHeight ;
445
+ }
446
+
447
+ if (textAttributes.alignment != oldProps->textAttributes .alignment ) {
448
+ result[" textAlign" ] = textAttributes.alignment .has_value ()
449
+ ? toString (textAttributes.alignment .value ())
450
+ : nullptr ;
451
+ }
452
+
453
+ if (textAttributes.baseWritingDirection !=
454
+ oldProps->textAttributes .baseWritingDirection ) {
455
+ result[" baseWritingDirection" ] =
456
+ textAttributes.baseWritingDirection .has_value ()
457
+ ? toString (textAttributes.baseWritingDirection .value ())
458
+ : nullptr ;
459
+ }
460
+
461
+ if (textAttributes.lineBreakStrategy !=
462
+ oldProps->textAttributes .lineBreakStrategy ) {
463
+ result[" lineBreakStrategyIOS" ] =
464
+ textAttributes.lineBreakStrategy .has_value ()
465
+ ? toString (textAttributes.lineBreakStrategy .value ())
466
+ : nullptr ;
467
+ }
468
+
469
+ if (textAttributes.lineBreakMode != oldProps->textAttributes .lineBreakMode ) {
470
+ result[" lineBreakModeIOS" ] = textAttributes.lineBreakMode .has_value ()
471
+ ? toString (textAttributes.lineBreakMode .value ())
472
+ : nullptr ;
473
+ }
474
+
475
+ if (textAttributes.textDecorationColor !=
476
+ oldProps->textAttributes .textDecorationColor ) {
477
+ result[" textDecorationColor" ] = *textAttributes.textDecorationColor ;
478
+ }
479
+
480
+ if (textAttributes.textDecorationLineType !=
481
+ oldProps->textAttributes .textDecorationLineType ) {
482
+ result[" textDecorationLine" ] =
483
+ textAttributes.textDecorationLineType .has_value ()
484
+ ? toString (textAttributes.textDecorationLineType .value ())
485
+ : nullptr ;
486
+ }
487
+
488
+ if (textAttributes.textDecorationStyle !=
489
+ oldProps->textAttributes .textDecorationStyle ) {
490
+ result[" textDecorationStyle" ] =
491
+ textAttributes.textDecorationStyle .has_value ()
492
+ ? toString (textAttributes.textDecorationStyle .value ())
493
+ : nullptr ;
494
+ }
495
+
496
+ if (textAttributes.textShadowOffset !=
497
+ oldProps->textAttributes .textShadowOffset ) {
498
+ result[" textShadowOffset" ] = textAttributes.textShadowOffset .has_value ()
499
+ ? toDynamic (textAttributes.textShadowOffset .value ())
500
+ : nullptr ;
501
+ }
502
+
503
+ if (textAttributes.textShadowRadius !=
504
+ oldProps->textAttributes .textShadowRadius ) {
505
+ result[" textShadowRadius" ] = textAttributes.textShadowRadius ;
506
+ }
507
+
508
+ if (textAttributes.textShadowColor !=
509
+ oldProps->textAttributes .textShadowColor ) {
510
+ result[" textShadowColor" ] = *textAttributes.textShadowColor ;
511
+ }
512
+
513
+ if (textAttributes.isHighlighted != oldProps->textAttributes .isHighlighted ) {
514
+ result[" isHighlighted" ] = textAttributes.isHighlighted .has_value ()
515
+ ? textAttributes.isHighlighted .value ()
516
+ : folly::dynamic (nullptr );
517
+ }
518
+
519
+ if (textAttributes.isPressable != oldProps->textAttributes .isPressable ) {
520
+ result[" isPressable" ] = textAttributes.isPressable .has_value ()
521
+ ? textAttributes.isPressable .value ()
522
+ : folly::dynamic (nullptr );
523
+ }
524
+
525
+ if (textAttributes.accessibilityRole !=
526
+ oldProps->textAttributes .accessibilityRole ) {
527
+ result[" accessibilityRole" ] = textAttributes.accessibilityRole .has_value ()
528
+ ? toString (textAttributes.accessibilityRole .value ())
529
+ : nullptr ;
530
+ }
531
+
532
+ if (textAttributes.role != oldProps->textAttributes .role ) {
533
+ result[" role" ] = textAttributes.role .has_value ()
534
+ ? toString (textAttributes.role .value ())
535
+ : nullptr ;
536
+ }
537
+
538
+ if (textAttributes.opacity != oldProps->textAttributes .opacity ) {
539
+ result[" opacity" ] = textAttributes.opacity ;
540
+ }
541
+
542
+ if (textAttributes.backgroundColor !=
543
+ oldProps->textAttributes .backgroundColor ) {
544
+ result[" backgroundColor" ] = *textAttributes.backgroundColor ;
545
+ }
546
+ }
547
+
548
+ #endif
359
549
} // namespace facebook::react
0 commit comments