react-native 0.70.8 → 0.70.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/React/Base/RCTVersion.m +1 -1
  3. package/ReactAndroid/gradle.properties +1 -1
  4. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  5. package/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java +4 -0
  6. package/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java +4 -0
  7. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java +1 -5
  8. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +9 -7
  9. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java +13 -5
  10. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +15 -15
  11. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +5 -0
  12. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/BUCK +9 -3
  13. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +204 -117
  14. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +78 -11
  15. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java +5 -0
  16. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  17. package/ReactCommon/react/renderer/components/text/ParagraphState.h +9 -0
  18. package/ReactCommon/react/renderer/components/text/conversions.h +1 -9
  19. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp +22 -0
  20. package/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h +1 -3
  21. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-debug.aar +0 -0
  22. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-debug.aar.md5 +1 -0
  23. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-debug.aar.sha1 +1 -0
  24. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-debug.aar.sha256 +1 -0
  25. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-debug.aar.sha512 +1 -0
  26. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-release.aar +0 -0
  27. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-release.aar.md5 +1 -0
  28. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-release.aar.sha1 +1 -0
  29. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-release.aar.sha256 +1 -0
  30. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9-release.aar.sha512 +1 -0
  31. package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8.module → 0.70.9/hermes-engine-0.70.9.module} +33 -33
  32. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.module.md5 +1 -0
  33. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.module.sha1 +1 -0
  34. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.module.sha256 +1 -0
  35. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.module.sha512 +1 -0
  36. package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8.pom → 0.70.9/hermes-engine-0.70.9.pom} +1 -1
  37. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.pom.md5 +1 -0
  38. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.pom.sha1 +1 -0
  39. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.pom.sha256 +1 -0
  40. package/android/com/facebook/react/hermes-engine/0.70.9/hermes-engine-0.70.9.pom.sha512 +1 -0
  41. package/android/com/facebook/react/hermes-engine/maven-metadata.xml +4 -4
  42. package/android/com/facebook/react/hermes-engine/maven-metadata.xml.md5 +1 -1
  43. package/android/com/facebook/react/hermes-engine/maven-metadata.xml.sha1 +1 -1
  44. package/android/com/facebook/react/hermes-engine/maven-metadata.xml.sha256 +1 -1
  45. package/android/com/facebook/react/hermes-engine/maven-metadata.xml.sha512 +1 -1
  46. package/android/com/facebook/react/react-native/{0.70.8/react-native-0.70.8-debug-sources.jar → 0.70.9/react-native-0.70.9-debug-sources.jar} +0 -0
  47. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug-sources.jar.md5 +1 -0
  48. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug-sources.jar.sha1 +1 -0
  49. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug-sources.jar.sha256 +1 -0
  50. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug-sources.jar.sha512 +1 -0
  51. package/android/com/facebook/react/react-native/{0.70.8/react-native-0.70.8-debug.aar → 0.70.9/react-native-0.70.9-debug.aar} +0 -0
  52. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug.aar.md5 +1 -0
  53. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug.aar.sha1 +1 -0
  54. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug.aar.sha256 +1 -0
  55. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-debug.aar.sha512 +1 -0
  56. package/android/com/facebook/react/react-native/{0.70.8/react-native-0.70.8-release-sources.jar → 0.70.9/react-native-0.70.9-release-sources.jar} +0 -0
  57. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release-sources.jar.md5 +1 -0
  58. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release-sources.jar.sha1 +1 -0
  59. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release-sources.jar.sha256 +1 -0
  60. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release-sources.jar.sha512 +1 -0
  61. package/android/com/facebook/react/react-native/{0.70.8/react-native-0.70.8-release.aar → 0.70.9/react-native-0.70.9-release.aar} +0 -0
  62. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release.aar.md5 +1 -0
  63. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release.aar.sha1 +1 -0
  64. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release.aar.sha256 +1 -0
  65. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9-release.aar.sha512 +1 -0
  66. package/android/com/facebook/react/react-native/{0.70.8/react-native-0.70.8.module → 0.70.9/react-native-0.70.9.module} +43 -43
  67. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.module.md5 +1 -0
  68. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.module.sha1 +1 -0
  69. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.module.sha256 +1 -0
  70. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.module.sha512 +1 -0
  71. package/android/com/facebook/react/react-native/{0.70.8/react-native-0.70.8.pom → 0.70.9/react-native-0.70.9.pom} +1 -1
  72. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.pom.md5 +1 -0
  73. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.pom.sha1 +1 -0
  74. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.pom.sha256 +1 -0
  75. package/android/com/facebook/react/react-native/0.70.9/react-native-0.70.9.pom.sha512 +1 -0
  76. package/android/com/facebook/react/react-native/maven-metadata.xml +4 -4
  77. package/android/com/facebook/react/react-native/maven-metadata.xml.md5 +1 -1
  78. package/android/com/facebook/react/react-native/maven-metadata.xml.sha1 +1 -1
  79. package/android/com/facebook/react/react-native/maven-metadata.xml.sha256 +1 -1
  80. package/android/com/facebook/react/react-native/maven-metadata.xml.sha512 +1 -1
  81. package/package.json +2 -1
  82. package/sdks/.hermesversion +1 -1
  83. package/sdks/hermesc/osx-bin/hermesc +0 -0
  84. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  85. package/template/package.json +1 -1
  86. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-debug.aar +0 -0
  87. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-debug.aar.md5 +0 -1
  88. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-debug.aar.sha1 +0 -1
  89. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-debug.aar.sha256 +0 -1
  90. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-debug.aar.sha512 +0 -1
  91. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-release.aar +0 -0
  92. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-release.aar.md5 +0 -1
  93. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-release.aar.sha1 +0 -1
  94. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-release.aar.sha256 +0 -1
  95. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8-release.aar.sha512 +0 -1
  96. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.module.md5 +0 -1
  97. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.module.sha1 +0 -1
  98. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.module.sha256 +0 -1
  99. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.module.sha512 +0 -1
  100. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.pom.md5 +0 -1
  101. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.pom.sha1 +0 -1
  102. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.pom.sha256 +0 -1
  103. package/android/com/facebook/react/hermes-engine/0.70.8/hermes-engine-0.70.8.pom.sha512 +0 -1
  104. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug-sources.jar.md5 +0 -1
  105. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug-sources.jar.sha1 +0 -1
  106. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug-sources.jar.sha256 +0 -1
  107. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug-sources.jar.sha512 +0 -1
  108. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug.aar.md5 +0 -1
  109. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug.aar.sha1 +0 -1
  110. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug.aar.sha256 +0 -1
  111. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-debug.aar.sha512 +0 -1
  112. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release-sources.jar.md5 +0 -1
  113. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release-sources.jar.sha1 +0 -1
  114. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release-sources.jar.sha256 +0 -1
  115. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release-sources.jar.sha512 +0 -1
  116. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release.aar.md5 +0 -1
  117. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release.aar.sha1 +0 -1
  118. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release.aar.sha256 +0 -1
  119. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8-release.aar.sha512 +0 -1
  120. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.module.md5 +0 -1
  121. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.module.sha1 +0 -1
  122. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.module.sha256 +0 -1
  123. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.module.sha512 +0 -1
  124. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.pom.md5 +0 -1
  125. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.pom.sha1 +0 -1
  126. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.pom.sha256 +0 -1
  127. package/android/com/facebook/react/react-native/0.70.8/react-native-0.70.8.pom.sha512 +0 -1
  128. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-debug-sources.jar → 0.70.9/hermes-engine-0.70.9-debug-sources.jar} +0 -0
  129. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-debug-sources.jar.md5 → 0.70.9/hermes-engine-0.70.9-debug-sources.jar.md5} +0 -0
  130. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-debug-sources.jar.sha1 → 0.70.9/hermes-engine-0.70.9-debug-sources.jar.sha1} +0 -0
  131. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-debug-sources.jar.sha256 → 0.70.9/hermes-engine-0.70.9-debug-sources.jar.sha256} +0 -0
  132. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-debug-sources.jar.sha512 → 0.70.9/hermes-engine-0.70.9-debug-sources.jar.sha512} +0 -0
  133. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-release-sources.jar → 0.70.9/hermes-engine-0.70.9-release-sources.jar} +0 -0
  134. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-release-sources.jar.md5 → 0.70.9/hermes-engine-0.70.9-release-sources.jar.md5} +0 -0
  135. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-release-sources.jar.sha1 → 0.70.9/hermes-engine-0.70.9-release-sources.jar.sha1} +0 -0
  136. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-release-sources.jar.sha256 → 0.70.9/hermes-engine-0.70.9-release-sources.jar.sha256} +0 -0
  137. /package/android/com/facebook/react/hermes-engine/{0.70.8/hermes-engine-0.70.8-release-sources.jar.sha512 → 0.70.9/hermes-engine-0.70.9-release-sources.jar.sha512} +0 -0
@@ -11,6 +11,8 @@ import static com.facebook.react.uimanager.UIManagerHelper.getReactContext;
11
11
  import static com.facebook.react.views.text.TextAttributeProps.UNSET;
12
12
 
13
13
  import android.content.Context;
14
+ import android.graphics.Color;
15
+ import android.graphics.Paint;
14
16
  import android.graphics.Rect;
15
17
  import android.graphics.Typeface;
16
18
  import android.graphics.drawable.Drawable;
@@ -50,15 +52,19 @@ import com.facebook.react.views.text.CustomLetterSpacingSpan;
50
52
  import com.facebook.react.views.text.CustomLineHeightSpan;
51
53
  import com.facebook.react.views.text.CustomStyleSpan;
52
54
  import com.facebook.react.views.text.ReactAbsoluteSizeSpan;
55
+ import com.facebook.react.views.text.ReactBackgroundColorSpan;
56
+ import com.facebook.react.views.text.ReactForegroundColorSpan;
53
57
  import com.facebook.react.views.text.ReactSpan;
58
+ import com.facebook.react.views.text.ReactStrikethroughSpan;
54
59
  import com.facebook.react.views.text.ReactTextUpdate;
55
60
  import com.facebook.react.views.text.ReactTypefaceUtils;
61
+ import com.facebook.react.views.text.ReactUnderlineSpan;
56
62
  import com.facebook.react.views.text.TextAttributes;
57
63
  import com.facebook.react.views.text.TextInlineImageSpan;
58
64
  import com.facebook.react.views.text.TextLayoutManager;
59
65
  import com.facebook.react.views.view.ReactViewBackgroundManager;
60
66
  import java.util.ArrayList;
61
- import java.util.List;
67
+ import java.util.Objects;
62
68
 
63
69
  /**
64
70
  * A wrapper around the EditText that lets us better control what happens when an EditText gets
@@ -82,7 +88,6 @@ public class ReactEditText extends AppCompatEditText
82
88
  // *TextChanged events should be triggered. This is less expensive than removing the text
83
89
  // listeners and adding them back again after the text change is completed.
84
90
  protected boolean mIsSettingTextFromJS;
85
- protected boolean mIsSettingTextFromCacheUpdate = false;
86
91
  private int mDefaultGravityHorizontal;
87
92
  private int mDefaultGravityVertical;
88
93
 
@@ -363,7 +368,7 @@ public class ReactEditText extends AppCompatEditText
363
368
  }
364
369
 
365
370
  super.onSelectionChanged(selStart, selEnd);
366
- if (!mIsSettingTextFromCacheUpdate && mSelectionWatcher != null && hasFocus()) {
371
+ if (mSelectionWatcher != null && hasFocus()) {
367
372
  mSelectionWatcher.onSelectionChanged(selStart, selEnd);
368
373
  }
369
374
  }
@@ -482,6 +487,14 @@ public class ReactEditText extends AppCompatEditText
482
487
  }
483
488
  }
484
489
 
490
+ @Override
491
+ public void setFontFeatureSettings(String fontFeatureSettings) {
492
+ if (!Objects.equals(fontFeatureSettings, getFontFeatureSettings())) {
493
+ super.setFontFeatureSettings(fontFeatureSettings);
494
+ mTypefaceDirty = true;
495
+ }
496
+ }
497
+
485
498
  public void maybeUpdateTypeface() {
486
499
  if (!mTypefaceDirty) {
487
500
  return;
@@ -493,6 +506,17 @@ public class ReactEditText extends AppCompatEditText
493
506
  ReactTypefaceUtils.applyStyles(
494
507
  getTypeface(), mFontStyle, mFontWeight, mFontFamily, getContext().getAssets());
495
508
  setTypeface(newTypeface);
509
+
510
+ // Match behavior of CustomStyleSpan and enable SUBPIXEL_TEXT_FLAG when setting anything
511
+ // nonstandard
512
+ if (mFontStyle != UNSET
513
+ || mFontWeight != UNSET
514
+ || mFontFamily != null
515
+ || getFontFeatureSettings() != null) {
516
+ setPaintFlags(getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
517
+ } else {
518
+ setPaintFlags(getPaintFlags() & (~Paint.SUBPIXEL_TEXT_FLAG));
519
+ }
496
520
  }
497
521
 
498
522
  // VisibleForTesting from {@link TextInputEventsTestCase}.
@@ -554,10 +578,8 @@ public class ReactEditText extends AppCompatEditText
554
578
  SpannableStringBuilder spannableStringBuilder =
555
579
  new SpannableStringBuilder(reactTextUpdate.getText());
556
580
 
557
- manageSpans(spannableStringBuilder, reactTextUpdate.mContainsMultipleFragments);
558
-
559
- // Mitigation for https://github.com/facebook/react-native/issues/35936 (S318090)
560
- stripAbsoluteSizeSpans(spannableStringBuilder);
581
+ manageSpans(spannableStringBuilder);
582
+ stripStyleEquivalentSpans(spannableStringBuilder);
561
583
 
562
584
  mContainsImages = reactTextUpdate.containsImages();
563
585
 
@@ -585,7 +607,7 @@ public class ReactEditText extends AppCompatEditText
585
607
  }
586
608
 
587
609
  // Update cached spans (in Fabric only).
588
- updateCachedSpannable(false);
610
+ updateCachedSpannable();
589
611
  }
590
612
 
591
613
  /**
@@ -594,8 +616,7 @@ public class ReactEditText extends AppCompatEditText
594
616
  * will adapt to the new text, hence why {@link SpannableStringBuilder#replace} never removes
595
617
  * them.
596
618
  */
597
- private void manageSpans(
598
- SpannableStringBuilder spannableStringBuilder, boolean skipAddSpansForMeasurements) {
619
+ private void manageSpans(SpannableStringBuilder spannableStringBuilder) {
599
620
  Object[] spans = getText().getSpans(0, length(), Object.class);
600
621
  for (int spanIdx = 0; spanIdx < spans.length; spanIdx++) {
601
622
  Object span = spans[spanIdx];
@@ -623,33 +644,170 @@ public class ReactEditText extends AppCompatEditText
623
644
  spannableStringBuilder.setSpan(span, spanStart, spanEnd, spanFlags);
624
645
  }
625
646
  }
647
+ }
648
+
649
+ // TODO: Replace with Predicate<T> and lambdas once Java 8 builds in OSS
650
+ interface SpanPredicate<T> {
651
+ boolean test(T span);
652
+ }
653
+
654
+ /**
655
+ * Remove spans from the SpannableStringBuilder which can be represented by TextAppearance
656
+ * attributes on the underlying EditText. This works around instability on Samsung devices with
657
+ * the presence of spans https://github.com/facebook/react-native/issues/35936 (S318090)
658
+ */
659
+ private void stripStyleEquivalentSpans(SpannableStringBuilder sb) {
660
+ stripSpansOfKind(
661
+ sb,
662
+ ReactAbsoluteSizeSpan.class,
663
+ new SpanPredicate<ReactAbsoluteSizeSpan>() {
664
+ @Override
665
+ public boolean test(ReactAbsoluteSizeSpan span) {
666
+ return span.getSize() == mTextAttributes.getEffectiveFontSize();
667
+ }
668
+ });
669
+
670
+ stripSpansOfKind(
671
+ sb,
672
+ ReactBackgroundColorSpan.class,
673
+ new SpanPredicate<ReactBackgroundColorSpan>() {
674
+ @Override
675
+ public boolean test(ReactBackgroundColorSpan span) {
676
+ return span.getBackgroundColor() == mReactBackgroundManager.getBackgroundColor();
677
+ }
678
+ });
626
679
 
627
- // In Fabric only, apply necessary styles to entire span
628
- // If the Spannable was constructed from multiple fragments, we don't apply any spans that could
629
- // impact the whole Spannable, because that would override "local" styles per-fragment
630
- if (!skipAddSpansForMeasurements) {
631
- addSpansForMeasurement(getText());
680
+ stripSpansOfKind(
681
+ sb,
682
+ ReactForegroundColorSpan.class,
683
+ new SpanPredicate<ReactForegroundColorSpan>() {
684
+ @Override
685
+ public boolean test(ReactForegroundColorSpan span) {
686
+ return span.getForegroundColor() == getCurrentTextColor();
687
+ }
688
+ });
689
+
690
+ stripSpansOfKind(
691
+ sb,
692
+ ReactStrikethroughSpan.class,
693
+ new SpanPredicate<ReactStrikethroughSpan>() {
694
+ @Override
695
+ public boolean test(ReactStrikethroughSpan span) {
696
+ return (getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) != 0;
697
+ }
698
+ });
699
+
700
+ stripSpansOfKind(
701
+ sb,
702
+ ReactUnderlineSpan.class,
703
+ new SpanPredicate<ReactUnderlineSpan>() {
704
+ @Override
705
+ public boolean test(ReactUnderlineSpan span) {
706
+ return (getPaintFlags() & Paint.UNDERLINE_TEXT_FLAG) != 0;
707
+ }
708
+ });
709
+
710
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
711
+ stripSpansOfKind(
712
+ sb,
713
+ CustomLetterSpacingSpan.class,
714
+ new SpanPredicate<CustomLetterSpacingSpan>() {
715
+ @Override
716
+ public boolean test(CustomLetterSpacingSpan span) {
717
+ return span.getSpacing() == mTextAttributes.getEffectiveLetterSpacing();
718
+ }
719
+ });
632
720
  }
721
+
722
+ stripSpansOfKind(
723
+ sb,
724
+ CustomStyleSpan.class,
725
+ new SpanPredicate<CustomStyleSpan>() {
726
+ @Override
727
+ public boolean test(CustomStyleSpan span) {
728
+ return span.getStyle() == mFontStyle
729
+ && Objects.equals(span.getFontFamily(), mFontFamily)
730
+ && span.getWeight() == mFontWeight
731
+ && Objects.equals(span.getFontFeatureSettings(), getFontFeatureSettings());
732
+ }
733
+ });
633
734
  }
634
735
 
635
- private void stripAbsoluteSizeSpans(SpannableStringBuilder sb) {
636
- // We have already set a font size on the EditText itself. We can safely remove sizing spans
637
- // which are the same as the set font size, and not otherwise overlapped.
638
- final int effectiveFontSize = mTextAttributes.getEffectiveFontSize();
639
- ReactAbsoluteSizeSpan[] spans = sb.getSpans(0, sb.length(), ReactAbsoluteSizeSpan.class);
736
+ private <T> void stripSpansOfKind(
737
+ SpannableStringBuilder sb, Class<T> clazz, SpanPredicate<T> shouldStrip) {
738
+ T[] spans = sb.getSpans(0, sb.length(), clazz);
640
739
 
641
- outerLoop:
642
- for (ReactAbsoluteSizeSpan span : spans) {
643
- ReactAbsoluteSizeSpan[] overlappingSpans =
644
- sb.getSpans(sb.getSpanStart(span), sb.getSpanEnd(span), ReactAbsoluteSizeSpan.class);
740
+ for (T span : spans) {
741
+ if (shouldStrip.test(span)) {
742
+ sb.removeSpan(span);
743
+ }
744
+ }
745
+ }
645
746
 
646
- for (ReactAbsoluteSizeSpan overlappingSpan : overlappingSpans) {
647
- if (span.getSize() != effectiveFontSize) {
648
- continue outerLoop;
649
- }
747
+ /**
748
+ * Copy styles represented as attributes to the underlying span, for later measurement or other
749
+ * usage outside the ReactEditText.
750
+ */
751
+ private void addSpansFromStyleAttributes(SpannableStringBuilder workingText) {
752
+ int spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE;
753
+
754
+ // Set all bits for SPAN_PRIORITY so that this span has the highest possible priority
755
+ // (least precedence). This ensures the span is behind any overlapping spans.
756
+ spanFlags |= Spannable.SPAN_PRIORITY;
757
+
758
+ workingText.setSpan(
759
+ new ReactAbsoluteSizeSpan(mTextAttributes.getEffectiveFontSize()),
760
+ 0,
761
+ workingText.length(),
762
+ spanFlags);
763
+
764
+ workingText.setSpan(
765
+ new ReactForegroundColorSpan(getCurrentTextColor()), 0, workingText.length(), spanFlags);
766
+
767
+ int backgroundColor = mReactBackgroundManager.getBackgroundColor();
768
+ if (backgroundColor != Color.TRANSPARENT) {
769
+ workingText.setSpan(
770
+ new ReactBackgroundColorSpan(backgroundColor), 0, workingText.length(), spanFlags);
771
+ }
772
+
773
+ if ((getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) != 0) {
774
+ workingText.setSpan(new ReactStrikethroughSpan(), 0, workingText.length(), spanFlags);
775
+ }
776
+
777
+ if ((getPaintFlags() & Paint.UNDERLINE_TEXT_FLAG) != 0) {
778
+ workingText.setSpan(new ReactUnderlineSpan(), 0, workingText.length(), spanFlags);
779
+ }
780
+
781
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
782
+ float effectiveLetterSpacing = mTextAttributes.getEffectiveLetterSpacing();
783
+ if (!Float.isNaN(effectiveLetterSpacing)) {
784
+ workingText.setSpan(
785
+ new CustomLetterSpacingSpan(effectiveLetterSpacing),
786
+ 0,
787
+ workingText.length(),
788
+ spanFlags);
650
789
  }
790
+ }
651
791
 
652
- sb.removeSpan(span);
792
+ if (mFontStyle != UNSET
793
+ || mFontWeight != UNSET
794
+ || mFontFamily != null
795
+ || getFontFeatureSettings() != null) {
796
+ workingText.setSpan(
797
+ new CustomStyleSpan(
798
+ mFontStyle,
799
+ mFontWeight,
800
+ getFontFeatureSettings(),
801
+ mFontFamily,
802
+ getContext().getAssets()),
803
+ 0,
804
+ workingText.length(),
805
+ spanFlags);
806
+ }
807
+
808
+ float lineHeight = mTextAttributes.getEffectiveLineHeight();
809
+ if (!Float.isNaN(lineHeight)) {
810
+ workingText.setSpan(new CustomLineHeightSpan(lineHeight), 0, workingText.length(), spanFlags);
653
811
  }
654
812
  }
655
813
 
@@ -669,73 +827,6 @@ public class ReactEditText extends AppCompatEditText
669
827
  return true;
670
828
  }
671
829
 
672
- // This is hacked in for Fabric. When we delete non-Fabric code, we might be able to simplify or
673
- // clean this up a bit.
674
- private void addSpansForMeasurement(Spannable spannable) {
675
- if (!mFabricViewStateManager.hasStateWrapper()) {
676
- return;
677
- }
678
-
679
- boolean originalDisableTextDiffing = mDisableTextDiffing;
680
- mDisableTextDiffing = true;
681
-
682
- int start = 0;
683
- int end = spannable.length();
684
-
685
- // Remove duplicate spans we might add here
686
- Object[] spans = spannable.getSpans(0, length(), Object.class);
687
- for (Object span : spans) {
688
- int spanFlags = spannable.getSpanFlags(span);
689
- boolean isInclusive =
690
- (spanFlags & Spanned.SPAN_INCLUSIVE_INCLUSIVE) == Spanned.SPAN_INCLUSIVE_INCLUSIVE
691
- || (spanFlags & Spanned.SPAN_INCLUSIVE_EXCLUSIVE) == Spanned.SPAN_INCLUSIVE_EXCLUSIVE;
692
- if (isInclusive
693
- && span instanceof ReactSpan
694
- && spannable.getSpanStart(span) == start
695
- && spannable.getSpanEnd(span) == end) {
696
- spannable.removeSpan(span);
697
- }
698
- }
699
-
700
- List<TextLayoutManager.SetSpanOperation> ops = new ArrayList<>();
701
-
702
- if (!Float.isNaN(mTextAttributes.getLetterSpacing())) {
703
- ops.add(
704
- new TextLayoutManager.SetSpanOperation(
705
- start, end, new CustomLetterSpacingSpan(mTextAttributes.getLetterSpacing())));
706
- }
707
- ops.add(
708
- new TextLayoutManager.SetSpanOperation(
709
- start, end, new ReactAbsoluteSizeSpan((int) mTextAttributes.getEffectiveFontSize())));
710
- if (mFontStyle != UNSET || mFontWeight != UNSET || mFontFamily != null) {
711
- ops.add(
712
- new TextLayoutManager.SetSpanOperation(
713
- start,
714
- end,
715
- new CustomStyleSpan(
716
- mFontStyle,
717
- mFontWeight,
718
- null, // TODO: do we need to support FontFeatureSettings / fontVariant?
719
- mFontFamily,
720
- getReactContext(ReactEditText.this).getAssets())));
721
- }
722
- if (!Float.isNaN(mTextAttributes.getEffectiveLineHeight())) {
723
- ops.add(
724
- new TextLayoutManager.SetSpanOperation(
725
- start, end, new CustomLineHeightSpan(mTextAttributes.getEffectiveLineHeight())));
726
- }
727
-
728
- int priority = 0;
729
- for (TextLayoutManager.SetSpanOperation op : ops) {
730
- // Actual order of calling {@code execute} does NOT matter,
731
- // but the {@code priority} DOES matter.
732
- op.execute(spannable, priority);
733
- priority++;
734
- }
735
-
736
- mDisableTextDiffing = originalDisableTextDiffing;
737
- }
738
-
739
830
  protected boolean showSoftKeyboard() {
740
831
  return mInputMethodManager.showSoftInput(this, 0);
741
832
  }
@@ -790,6 +881,11 @@ public class ReactEditText extends AppCompatEditText
790
881
  }
791
882
  }
792
883
 
884
+ /* package */ int getGravityHorizontal() {
885
+ return getGravity()
886
+ & (Gravity.HORIZONTAL_GRAVITY_MASK | Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK);
887
+ }
888
+
793
889
  /* package */ void setGravityHorizontal(int gravityHorizontal) {
794
890
  if (gravityHorizontal == 0) {
795
891
  gravityHorizontal = mDefaultGravityHorizontal;
@@ -1000,7 +1096,9 @@ public class ReactEditText extends AppCompatEditText
1000
1096
 
1001
1097
  float effectiveLetterSpacing = mTextAttributes.getEffectiveLetterSpacing();
1002
1098
  if (!Float.isNaN(effectiveLetterSpacing)) {
1003
- setLetterSpacing(effectiveLetterSpacing);
1099
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
1100
+ setLetterSpacing(effectiveLetterSpacing);
1101
+ }
1004
1102
  }
1005
1103
  }
1006
1104
 
@@ -1015,7 +1113,7 @@ public class ReactEditText extends AppCompatEditText
1015
1113
  * TextLayoutManager.java with some very minor modifications. There's some duplication between
1016
1114
  * here and TextLayoutManager, so there might be an opportunity for refactor.
1017
1115
  */
1018
- private void updateCachedSpannable(boolean resetStyles) {
1116
+ private void updateCachedSpannable() {
1019
1117
  // Noops in non-Fabric
1020
1118
  if (mFabricViewStateManager == null || !mFabricViewStateManager.hasStateWrapper()) {
1021
1119
  return;
@@ -1025,12 +1123,6 @@ public class ReactEditText extends AppCompatEditText
1025
1123
  return;
1026
1124
  }
1027
1125
 
1028
- if (resetStyles) {
1029
- mIsSettingTextFromCacheUpdate = true;
1030
- addSpansForMeasurement(getText());
1031
- mIsSettingTextFromCacheUpdate = false;
1032
- }
1033
-
1034
1126
  Editable currentText = getText();
1035
1127
  boolean haveText = currentText != null && currentText.length() > 0;
1036
1128
 
@@ -1088,11 +1180,9 @@ public class ReactEditText extends AppCompatEditText
1088
1180
  // Measure something so we have correct height, even if there's no string.
1089
1181
  sb.append("I");
1090
1182
  }
1091
-
1092
- // Make sure that all text styles are applied when we're measurable the hint or "blank" text
1093
- addSpansForMeasurement(sb);
1094
1183
  }
1095
1184
 
1185
+ addSpansFromStyleAttributes(sb);
1096
1186
  TextLayoutManager.setCachedSpannabledForTag(getId(), sb);
1097
1187
  }
1098
1188
 
@@ -1107,7 +1197,7 @@ public class ReactEditText extends AppCompatEditText
1107
1197
  private class TextWatcherDelegator implements TextWatcher {
1108
1198
  @Override
1109
1199
  public void beforeTextChanged(CharSequence s, int start, int count, int after) {
1110
- if (!mIsSettingTextFromCacheUpdate && !mIsSettingTextFromJS && mListeners != null) {
1200
+ if (!mIsSettingTextFromJS && mListeners != null) {
1111
1201
  for (TextWatcher listener : mListeners) {
1112
1202
  listener.beforeTextChanged(s, start, count, after);
1113
1203
  }
@@ -1121,23 +1211,20 @@ public class ReactEditText extends AppCompatEditText
1121
1211
  TAG, "onTextChanged[" + getId() + "]: " + s + " " + start + " " + before + " " + count);
1122
1212
  }
1123
1213
 
1124
- if (!mIsSettingTextFromCacheUpdate) {
1125
- if (!mIsSettingTextFromJS && mListeners != null) {
1126
- for (TextWatcher listener : mListeners) {
1127
- listener.onTextChanged(s, start, before, count);
1128
- }
1214
+ if (!mIsSettingTextFromJS && mListeners != null) {
1215
+ for (TextWatcher listener : mListeners) {
1216
+ listener.onTextChanged(s, start, before, count);
1129
1217
  }
1130
-
1131
- updateCachedSpannable(
1132
- !mIsSettingTextFromJS && !mIsSettingTextFromState && start == 0 && before == 0);
1133
1218
  }
1134
1219
 
1220
+ updateCachedSpannable();
1221
+
1135
1222
  onContentSizeChange();
1136
1223
  }
1137
1224
 
1138
1225
  @Override
1139
1226
  public void afterTextChanged(Editable s) {
1140
- if (!mIsSettingTextFromCacheUpdate && !mIsSettingTextFromJS && mListeners != null) {
1227
+ if (!mIsSettingTextFromJS && mListeners != null) {
1141
1228
  for (TextWatcher listener : mListeners) {
1142
1229
  listener.afterTextChanged(s);
1143
1230
  }
@@ -13,6 +13,7 @@ import android.content.Context;
13
13
  import android.content.res.ColorStateList;
14
14
  import android.graphics.BlendMode;
15
15
  import android.graphics.BlendModeColorFilter;
16
+ import android.graphics.Paint;
16
17
  import android.graphics.PorterDuff;
17
18
  import android.graphics.drawable.Drawable;
18
19
  import android.os.Build;
@@ -44,6 +45,8 @@ import com.facebook.react.bridge.ReadableType;
44
45
  import com.facebook.react.bridge.WritableMap;
45
46
  import com.facebook.react.bridge.WritableNativeMap;
46
47
  import com.facebook.react.common.MapBuilder;
48
+ import com.facebook.react.common.mapbuffer.MapBuffer;
49
+ import com.facebook.react.config.ReactFeatureFlags;
47
50
  import com.facebook.react.module.annotations.ReactModule;
48
51
  import com.facebook.react.uimanager.BaseViewManager;
49
52
  import com.facebook.react.uimanager.FabricViewStateManager;
@@ -66,9 +69,11 @@ import com.facebook.react.views.text.DefaultStyleValuesUtil;
66
69
  import com.facebook.react.views.text.ReactBaseTextShadowNode;
67
70
  import com.facebook.react.views.text.ReactTextUpdate;
68
71
  import com.facebook.react.views.text.ReactTextViewManagerCallback;
72
+ import com.facebook.react.views.text.ReactTypefaceUtils;
69
73
  import com.facebook.react.views.text.TextAttributeProps;
70
74
  import com.facebook.react.views.text.TextInlineImageSpan;
71
75
  import com.facebook.react.views.text.TextLayoutManager;
76
+ import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
72
77
  import com.facebook.react.views.text.TextTransform;
73
78
  import com.facebook.yoga.YogaConstants;
74
79
  import java.lang.reflect.Field;
@@ -83,6 +88,12 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
83
88
  public static final String TAG = ReactTextInputManager.class.getSimpleName();
84
89
  public static final String REACT_CLASS = "AndroidTextInput";
85
90
 
91
+ // See also ReactTextViewManager
92
+ private static final short TX_STATE_KEY_ATTRIBUTED_STRING = 0;
93
+ private static final short TX_STATE_KEY_PARAGRAPH_ATTRIBUTES = 1;
94
+ private static final short TX_STATE_KEY_HASH = 2;
95
+ private static final short TX_STATE_KEY_MOST_RECENT_EVENT_COUNT = 3;
96
+
86
97
  private static final int[] SPACING_TYPES = {
87
98
  Spacing.ALL, Spacing.LEFT, Spacing.RIGHT, Spacing.TOP, Spacing.BOTTOM,
88
99
  };
@@ -396,6 +407,11 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
396
407
  view.setFontStyle(fontStyle);
397
408
  }
398
409
 
410
+ @ReactProp(name = ViewProps.FONT_VARIANT)
411
+ public void setFontVariant(ReactEditText view, @Nullable ReadableArray fontVariant) {
412
+ view.setFontFeatureSettings(ReactTypefaceUtils.parseFontVariant(fontVariant));
413
+ }
414
+
399
415
  @ReactProp(name = ViewProps.INCLUDE_FONT_PADDING, defaultBoolean = true)
400
416
  public void setIncludeFontPadding(ReactEditText view, boolean includepad) {
401
417
  view.setIncludeFontPadding(includepad);
@@ -912,6 +928,20 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
912
928
  view.setAutoFocus(autoFocus);
913
929
  }
914
930
 
931
+ @ReactProp(name = ViewProps.TEXT_DECORATION_LINE)
932
+ public void setTextDecorationLine(ReactEditText view, @Nullable String textDecorationLineString) {
933
+ view.setPaintFlags(
934
+ view.getPaintFlags() & ~(Paint.STRIKE_THRU_TEXT_FLAG | Paint.UNDERLINE_TEXT_FLAG));
935
+
936
+ for (String token : textDecorationLineString.split(" ")) {
937
+ if (token.equals("underline")) {
938
+ view.setPaintFlags(view.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
939
+ } else if (token.equals("line-through")) {
940
+ view.setPaintFlags(view.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
941
+ }
942
+ }
943
+ }
944
+
915
945
  @ReactPropGroup(
916
946
  names = {
917
947
  ViewProps.BORDER_WIDTH,
@@ -1284,11 +1314,15 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
1284
1314
 
1285
1315
  stateManager.setStateWrapper(stateWrapper);
1286
1316
 
1287
- ReadableNativeMap state = stateWrapper.getStateData();
1288
- if (state == null) {
1289
- return null;
1317
+ if (ReactFeatureFlags.mapBufferSerializationEnabled) {
1318
+ MapBuffer stateMapBuffer = stateWrapper.getStateDataMapBuffer();
1319
+ if (stateMapBuffer != null) {
1320
+ return getReactTextUpdate(view, props, stateMapBuffer);
1321
+ }
1290
1322
  }
1291
- if (!state.hasKey("attributedString")) {
1323
+
1324
+ ReadableNativeMap state = stateWrapper.getStateData();
1325
+ if (state == null || !state.hasKey("attributedString")) {
1292
1326
  return null;
1293
1327
  }
1294
1328
 
@@ -1302,18 +1336,51 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
1302
1336
  TextLayoutManager.getOrCreateSpannableForText(
1303
1337
  view.getContext(), attributedString, mReactTextViewManagerCallback);
1304
1338
 
1305
- boolean containsMultipleFragments =
1306
- attributedString.getArray("fragments").toArrayList().size() > 1;
1307
-
1308
1339
  int textBreakStrategy =
1309
- TextAttributeProps.getTextBreakStrategy(paragraphAttributes.getString("textBreakStrategy"));
1340
+ TextAttributeProps.getTextBreakStrategy(
1341
+ paragraphAttributes.getString(ViewProps.TEXT_BREAK_STRATEGY));
1342
+ int currentJustificationMode =
1343
+ Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? 0 : view.getJustificationMode();
1310
1344
 
1311
1345
  return ReactTextUpdate.buildReactTextUpdateFromState(
1312
1346
  spanned,
1313
1347
  state.getInt("mostRecentEventCount"),
1314
- TextAttributeProps.getTextAlignment(props, TextLayoutManager.isRTL(attributedString)),
1348
+ TextAttributeProps.getTextAlignment(
1349
+ props, TextLayoutManager.isRTL(attributedString), view.getGravityHorizontal()),
1350
+ textBreakStrategy,
1351
+ TextAttributeProps.getJustificationMode(props, currentJustificationMode));
1352
+ }
1353
+
1354
+ public Object getReactTextUpdate(ReactEditText view, ReactStylesDiffMap props, MapBuffer state) {
1355
+ // If native wants to update the state wrapper but the state data hasn't actually
1356
+ // changed, the MapBuffer may be empty
1357
+ if (state.getCount() == 0) {
1358
+ return null;
1359
+ }
1360
+
1361
+ MapBuffer attributedString = state.getMapBuffer(TX_STATE_KEY_ATTRIBUTED_STRING);
1362
+ MapBuffer paragraphAttributes = state.getMapBuffer(TX_STATE_KEY_PARAGRAPH_ATTRIBUTES);
1363
+ if (attributedString == null || paragraphAttributes == null) {
1364
+ throw new IllegalArgumentException(
1365
+ "Invalid TextInput State (MapBuffer) was received as a parameters");
1366
+ }
1367
+
1368
+ Spannable spanned =
1369
+ TextLayoutManagerMapBuffer.getOrCreateSpannableForText(
1370
+ view.getContext(), attributedString, mReactTextViewManagerCallback);
1371
+
1372
+ int textBreakStrategy =
1373
+ TextAttributeProps.getTextBreakStrategy(
1374
+ paragraphAttributes.getString(TextLayoutManagerMapBuffer.PA_KEY_TEXT_BREAK_STRATEGY));
1375
+ int currentJustificationMode =
1376
+ Build.VERSION.SDK_INT < Build.VERSION_CODES.O ? 0 : view.getJustificationMode();
1377
+
1378
+ return ReactTextUpdate.buildReactTextUpdateFromState(
1379
+ spanned,
1380
+ state.getInt(TX_STATE_KEY_MOST_RECENT_EVENT_COUNT),
1381
+ TextAttributeProps.getTextAlignment(
1382
+ props, TextLayoutManagerMapBuffer.isRTL(attributedString), view.getGravityHorizontal()),
1315
1383
  textBreakStrategy,
1316
- TextAttributeProps.getJustificationMode(props),
1317
- containsMultipleFragments);
1384
+ TextAttributeProps.getJustificationMode(props, currentJustificationMode));
1318
1385
  }
1319
1386
  }
@@ -19,6 +19,7 @@ public class ReactViewBackgroundManager {
19
19
 
20
20
  private @Nullable ReactViewBackgroundDrawable mReactBackgroundDrawable;
21
21
  private View mView;
22
+ private int mColor = Color.TRANSPARENT;
22
23
 
23
24
  public ReactViewBackgroundManager(View view) {
24
25
  this.mView = view;
@@ -56,6 +57,10 @@ public class ReactViewBackgroundManager {
56
57
  }
57
58
  }
58
59
 
60
+ public int getBackgroundColor() {
61
+ return mColor;
62
+ }
63
+
59
64
  public void setBorderWidth(int position, float width) {
60
65
  getOrCreateReactViewBackground().setBorderWidth(position, width);
61
66
  }
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 70;
20
- int32_t Patch = 8;
20
+ int32_t Patch = 9;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -20,6 +20,15 @@
20
20
  namespace facebook {
21
21
  namespace react {
22
22
 
23
+ #ifdef ANDROID
24
+ // constants for Text State serialization
25
+ constexpr static MapBuffer::Key TX_STATE_KEY_ATTRIBUTED_STRING = 0;
26
+ constexpr static MapBuffer::Key TX_STATE_KEY_PARAGRAPH_ATTRIBUTES = 1;
27
+ // Used for TextInput only
28
+ constexpr static MapBuffer::Key TX_STATE_KEY_HASH = 2;
29
+ constexpr static MapBuffer::Key TX_STATE_KEY_MOST_RECENT_EVENT_COUNT = 3;
30
+ #endif
31
+
23
32
  /*
24
33
  * State for <Paragraph> component.
25
34
  * Represents what to render and how to render.
@@ -26,21 +26,13 @@ inline folly::dynamic toDynamic(ParagraphState const &paragraphState) {
26
26
  return newState;
27
27
  }
28
28
 
29
- // constants for Text State serialization
30
- constexpr static MapBuffer::Key TX_STATE_KEY_ATTRIBUTED_STRING = 0;
31
- constexpr static MapBuffer::Key TX_STATE_KEY_PARAGRAPH_ATTRIBUTES = 1;
32
- // Used for TextInput
33
- constexpr static MapBuffer::Key TX_STATE_KEY_HASH = 2;
34
- constexpr static MapBuffer::Key TX_STATE_KEY_MOST_RECENT_EVENT_COUNT = 3;
35
-
36
29
  inline MapBuffer toMapBuffer(ParagraphState const &paragraphState) {
37
30
  auto builder = MapBufferBuilder();
38
31
  auto attStringMapBuffer = toMapBuffer(paragraphState.attributedString);
39
32
  builder.putMapBuffer(TX_STATE_KEY_ATTRIBUTED_STRING, attStringMapBuffer);
40
33
  auto paMapBuffer = toMapBuffer(paragraphState.paragraphAttributes);
41
34
  builder.putMapBuffer(TX_STATE_KEY_PARAGRAPH_ATTRIBUTES, paMapBuffer);
42
- // TODO: Used for TextInput
43
- builder.putInt(TX_STATE_KEY_HASH, 1234);
35
+ builder.putInt(TX_STATE_KEY_HASH, attStringMapBuffer.getInt(AS_KEY_HASH));
44
36
  return builder.build();
45
37
  }
46
38
  #endif