diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index d6652f111abb76..386775c2b1293d 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -6733,29 +6733,6 @@ public class com/facebook/react/views/switchview/ReactSwitchManager$ReactSwitchS public fun setProperty (Lcom/facebook/react/views/switchview/ReactSwitchManager$ReactSwitchShadowNode;Ljava/lang/String;Ljava/lang/Object;)V } -public class com/facebook/react/views/text/CustomLetterSpacingSpan : android/text/style/MetricAffectingSpan, com/facebook/react/views/text/ReactSpan { - public fun (F)V - public fun getSpacing ()F - public fun updateDrawState (Landroid/text/TextPaint;)V - public fun updateMeasureState (Landroid/text/TextPaint;)V -} - -public class com/facebook/react/views/text/CustomLineHeightSpan : android/text/style/LineHeightSpan, com/facebook/react/views/text/ReactSpan { - public fun (F)V - public fun chooseHeight (Ljava/lang/CharSequence;IIIILandroid/graphics/Paint$FontMetricsInt;)V - public fun getLineHeight ()I -} - -public class com/facebook/react/views/text/CustomStyleSpan : android/text/style/MetricAffectingSpan, com/facebook/react/views/text/ReactSpan { - public fun (IILjava/lang/String;Ljava/lang/String;Landroid/content/res/AssetManager;)V - public fun getFontFamily ()Ljava/lang/String; - public fun getFontFeatureSettings ()Ljava/lang/String; - public fun getStyle ()I - public fun getWeight ()I - public fun updateDrawState (Landroid/text/TextPaint;)V - public fun updateMeasureState (Landroid/text/TextPaint;)V -} - public final class com/facebook/react/views/text/DefaultStyleValuesUtil { public static fun getDefaultTextColor (Landroid/content/Context;)Landroid/content/res/ColorStateList; public static fun getDefaultTextColorHighlight (Landroid/content/Context;)I @@ -6767,14 +6744,6 @@ public class com/facebook/react/views/text/FontMetricsUtil { public static fun getFontMetrics (Ljava/lang/CharSequence;Landroid/text/Layout;Landroid/text/TextPaint;Landroid/content/Context;)Lcom/facebook/react/bridge/WritableArray; } -public class com/facebook/react/views/text/ReactAbsoluteSizeSpan : android/text/style/AbsoluteSizeSpan, com/facebook/react/views/text/ReactSpan { - public fun (I)V -} - -public class com/facebook/react/views/text/ReactBackgroundColorSpan : android/text/style/BackgroundColorSpan, com/facebook/react/views/text/ReactSpan { - public fun (I)V -} - public abstract class com/facebook/react/views/text/ReactBaseTextShadowNode : com/facebook/react/uimanager/LayoutShadowNode, com/facebook/react/views/text/BasicTextAttributeProvider { public static final field DEFAULT_TEXT_SHADOW_COLOR I public static final field PROP_SHADOW_COLOR Ljava/lang/String; @@ -6866,10 +6835,6 @@ public class com/facebook/react/views/text/ReactFontManager { public fun setTypeface (Ljava/lang/String;ILandroid/graphics/Typeface;)V } -public class com/facebook/react/views/text/ReactForegroundColorSpan : android/text/style/ForegroundColorSpan, com/facebook/react/views/text/ReactSpan { - public fun (I)V -} - public class com/facebook/react/views/text/ReactRawTextManager : com/facebook/react/uimanager/ViewManager { public fun ()V public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode; @@ -6903,18 +6868,6 @@ public class com/facebook/react/views/text/ReactRawTextShadowNode$$PropsSetter : public fun setProperty (Lcom/facebook/react/views/text/ReactRawTextShadowNode;Ljava/lang/String;Ljava/lang/Object;)V } -public abstract interface class com/facebook/react/views/text/ReactSpan { -} - -public class com/facebook/react/views/text/ReactStrikethroughSpan : android/text/style/StrikethroughSpan, com/facebook/react/views/text/ReactSpan { - public fun ()V -} - -public class com/facebook/react/views/text/ReactTagSpan : com/facebook/react/views/text/ReactSpan { - public fun (I)V - public fun getReactTag ()I -} - public abstract class com/facebook/react/views/text/ReactTextAnchorViewManager : com/facebook/react/uimanager/BaseViewManager { public fun ()V public fun setAccessible (Lcom/facebook/react/views/text/ReactTextView;Z)V @@ -6937,11 +6890,6 @@ public abstract class com/facebook/react/views/text/ReactTextAnchorViewManager : public fun setTextAlignVertical (Lcom/facebook/react/views/text/ReactTextView;Ljava/lang/String;)V } -public abstract class com/facebook/react/views/text/ReactTextInlineImageShadowNode : com/facebook/react/uimanager/LayoutShadowNode { - public fun ()V - public abstract fun buildInlineImageSpan ()Lcom/facebook/react/views/text/TextInlineImageSpan; -} - public class com/facebook/react/views/text/ReactTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode { public fun ()V public fun (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V @@ -7056,10 +7004,6 @@ public class com/facebook/react/views/text/ReactTypefaceUtils { public static fun parseFontWeight (Ljava/lang/String;)I } -public class com/facebook/react/views/text/ReactUnderlineSpan : android/text/style/UnderlineSpan, com/facebook/react/views/text/ReactSpan { - public fun ()V -} - public class com/facebook/react/views/text/ReactVirtualTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode { public fun ()V public fun isVirtual ()Z @@ -7089,18 +7033,6 @@ public class com/facebook/react/views/text/ReactVirtualTextViewManager$$PropsSet public fun setProperty (Lcom/facebook/react/views/text/ReactVirtualTextViewManager;Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V } -public class com/facebook/react/views/text/SetSpanOperation { - protected field end I - protected field start I - protected field what Lcom/facebook/react/views/text/ReactSpan; - public fun execute (Landroid/text/SpannableStringBuilder;I)V -} - -public class com/facebook/react/views/text/ShadowStyleSpan : android/text/style/CharacterStyle, com/facebook/react/views/text/ReactSpan { - public fun (FFFI)V - public fun updateDrawState (Landroid/text/TextPaint;)V -} - public class com/facebook/react/views/text/TextAttributeProps : com/facebook/react/views/text/EffectiveTextAttributeProvider { public static final field TA_KEY_ACCESSIBILITY_ROLE S public static final field TA_KEY_ALIGNMENT S @@ -7213,28 +7145,6 @@ public class com/facebook/react/views/text/TextAttributes { public fun toString ()Ljava/lang/String; } -public abstract class com/facebook/react/views/text/TextInlineImageSpan : android/text/style/ReplacementSpan, com/facebook/react/views/text/ReactSpan { - public fun ()V - public abstract fun getDrawable ()Landroid/graphics/drawable/Drawable; - public abstract fun getHeight ()I - public abstract fun getWidth ()I - public abstract fun onAttachedToWindow ()V - public abstract fun onDetachedFromWindow ()V - public abstract fun onFinishTemporaryDetach ()V - public abstract fun onStartTemporaryDetach ()V - public static fun possiblyUpdateInlineImageSpans (Landroid/text/Spannable;Landroid/widget/TextView;)V - public abstract fun setTextView (Landroid/widget/TextView;)V -} - -public class com/facebook/react/views/text/TextInlineViewPlaceholderSpan : android/text/style/ReplacementSpan, com/facebook/react/views/text/ReactSpan { - public fun (III)V - public fun draw (Landroid/graphics/Canvas;Ljava/lang/CharSequence;IIFIIILandroid/graphics/Paint;)V - public fun getHeight ()I - public fun getReactTag ()I - public fun getSize (Landroid/graphics/Paint;Ljava/lang/CharSequence;IILandroid/graphics/Paint$FontMetricsInt;)I - public fun getWidth ()I -} - public class com/facebook/react/views/text/TextLayoutManager { public fun ()V public static fun deleteCachedSpannableForTag (I)V diff --git a/packages/react-native/ReactAndroid/gradle.properties b/packages/react-native/ReactAndroid/gradle.properties index c648a004285b6d..31a4a4d071d617 100644 --- a/packages/react-native/ReactAndroid/gradle.properties +++ b/packages/react-native/ReactAndroid/gradle.properties @@ -20,6 +20,7 @@ binaryCompatibilityValidator.ignoredPackages=com.facebook.debug,\ com.facebook.react.internal,\ com.facebook.react.module.processing,\ com.facebook.react.processing,\ + com.facebook.react.views.text.internal,\ com.facebook.systrace,\ com.facebook.yoga binaryCompatibilityValidator.nonPublicMarkers=com.facebook.react.common.annotations.VisibleForTesting,\ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java index 2c0489df363696..b7627dc9863435 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java @@ -31,6 +31,22 @@ import com.facebook.react.uimanager.ReactShadowNode; import com.facebook.react.uimanager.ViewProps; import com.facebook.react.uimanager.annotations.ReactProp; +import com.facebook.react.views.text.internal.ReactTextInlineImageShadowNode; +import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan; +import com.facebook.react.views.text.internal.span.CustomLineHeightSpan; +import com.facebook.react.views.text.internal.span.CustomStyleSpan; +import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan; +import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactClickableSpan; +import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactSpan; +import com.facebook.react.views.text.internal.span.ReactStrikethroughSpan; +import com.facebook.react.views.text.internal.span.ReactTagSpan; +import com.facebook.react.views.text.internal.span.ReactUnderlineSpan; +import com.facebook.react.views.text.internal.span.SetSpanOperation; +import com.facebook.react.views.text.internal.span.ShadowStyleSpan; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; +import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan; import com.facebook.yoga.YogaDirection; import com.facebook.yoga.YogaUnit; import com.facebook.yoga.YogaValue; @@ -366,15 +382,16 @@ protected Spannable spannedFromShadowNode( // or images. for (int priorityIndex = 0; priorityIndex < ops.size(); priorityIndex++) { final SetSpanOperation op = ops.get(ops.size() - priorityIndex - 1); + final ReactSpan what = op.getWhat(); - boolean isInlineImage = op.what instanceof TextInlineImageSpan; - if (isInlineImage || op.what instanceof TextInlineViewPlaceholderSpan) { + boolean isInlineImage = what instanceof TextInlineImageSpan; + if (isInlineImage || what instanceof TextInlineViewPlaceholderSpan) { int height; if (isInlineImage) { - height = ((TextInlineImageSpan) op.what).getHeight(); + height = ((TextInlineImageSpan) what).getHeight(); textShadowNode.mContainsImages = true; } else { - TextInlineViewPlaceholderSpan placeholder = (TextInlineViewPlaceholderSpan) op.what; + TextInlineViewPlaceholderSpan placeholder = (TextInlineViewPlaceholderSpan) what; height = placeholder.getHeight(); // Inline views cannot be layout-only because the ReactTextView needs to be able to grab diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java index 9b7d15715c90aa..96bb3495cd31d0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java @@ -32,6 +32,8 @@ import com.facebook.react.uimanager.UIViewOperationQueue; import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.events.RCTEventEmitter; +import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan; +import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan; import com.facebook.yoga.YogaBaselineFunction; import com.facebook.yoga.YogaConstants; import com.facebook.yoga.YogaDirection; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java index d0343a59e556cb..cf50efcbfa1a0a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java @@ -40,6 +40,9 @@ import com.facebook.react.uimanager.ViewDefaults; import com.facebook.react.uimanager.common.UIManagerType; import com.facebook.react.uimanager.common.ViewUtil; +import com.facebook.react.views.text.internal.span.ReactTagSpan; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; +import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan; import com.facebook.react.views.view.ReactViewBackgroundManager; import java.util.ArrayList; import java.util.Collections; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java index 705223f832d4c8..de2f290935549f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java @@ -25,6 +25,8 @@ import com.facebook.react.uimanager.StateWrapper; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.ViewProps; +import com.facebook.react.views.text.internal.span.ReactClickableSpan; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; import com.facebook.yoga.YogaMeasureMode; import java.util.HashMap; import java.util.Map; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java index 439401492d9258..8c555f2f978671 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java @@ -38,6 +38,19 @@ import com.facebook.react.uimanager.ReactStylesDiffMap; import com.facebook.react.uimanager.ViewProps; import com.facebook.react.views.text.fragments.BridgeTextFragmentList; +import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan; +import com.facebook.react.views.text.internal.span.CustomLineHeightSpan; +import com.facebook.react.views.text.internal.span.CustomStyleSpan; +import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan; +import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactClickableSpan; +import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactStrikethroughSpan; +import com.facebook.react.views.text.internal.span.ReactTagSpan; +import com.facebook.react.views.text.internal.span.ReactUnderlineSpan; +import com.facebook.react.views.text.internal.span.SetSpanOperation; +import com.facebook.react.views.text.internal.span.ShadowStyleSpan; +import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan; import com.facebook.yoga.YogaConstants; import com.facebook.yoga.YogaMeasureMode; import com.facebook.yoga.YogaMeasureOutput; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java index f6f0287db6d883..ca49eb72eefb21 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java @@ -37,6 +37,19 @@ import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole; import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role; import com.facebook.react.views.text.fragments.MapBufferTextFragmentList; +import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan; +import com.facebook.react.views.text.internal.span.CustomLineHeightSpan; +import com.facebook.react.views.text.internal.span.CustomStyleSpan; +import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan; +import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactClickableSpan; +import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactStrikethroughSpan; +import com.facebook.react.views.text.internal.span.ReactTagSpan; +import com.facebook.react.views.text.internal.span.ReactUnderlineSpan; +import com.facebook.react.views.text.internal.span.SetSpanOperation; +import com.facebook.react.views.text.internal.span.ShadowStyleSpan; +import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan; import com.facebook.yoga.YogaConstants; import com.facebook.yoga.YogaMeasureMode; import com.facebook.yoga.YogaMeasureOutput; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt index c23cd93acd139e..e72afed9458222 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutUtils.kt @@ -9,13 +9,27 @@ package com.facebook.react.views.text import android.content.Context import android.graphics.Color -import android.text.* +import android.text.Spannable +import android.text.SpannableStringBuilder import android.view.View import com.facebook.react.common.ReactConstants import com.facebook.react.uimanager.PixelUtil import com.facebook.react.uimanager.ReactAccessibilityDelegate import com.facebook.react.views.text.fragments.TextFragment import com.facebook.react.views.text.fragments.TextFragmentList +import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan +import com.facebook.react.views.text.internal.span.CustomLineHeightSpan +import com.facebook.react.views.text.internal.span.CustomStyleSpan +import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan +import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan +import com.facebook.react.views.text.internal.span.ReactClickableSpan +import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan +import com.facebook.react.views.text.internal.span.ReactStrikethroughSpan +import com.facebook.react.views.text.internal.span.ReactTagSpan +import com.facebook.react.views.text.internal.span.ReactUnderlineSpan +import com.facebook.react.views.text.internal.span.SetSpanOperation +import com.facebook.react.views.text.internal.span.ShadowStyleSpan +import com.facebook.react.views.text.internal.span.TextInlineViewPlaceholderSpan /** Utility methods for building [Spannable]s */ internal object TextLayoutUtils { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java index 7891aee93a030c..a512b20833caca 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java @@ -21,8 +21,8 @@ import com.facebook.react.common.ReactConstants; import com.facebook.react.uimanager.ViewProps; import com.facebook.react.uimanager.annotations.ReactProp; -import com.facebook.react.views.text.ReactTextInlineImageShadowNode; -import com.facebook.react.views.text.TextInlineImageSpan; +import com.facebook.react.views.text.internal.ReactTextInlineImageShadowNode; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; import com.facebook.yoga.YogaConstants; import java.util.Locale; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java index 3dfe989cd3c96c..2f3cf1cc3daa82 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java @@ -27,7 +27,7 @@ import com.facebook.react.modules.fresco.ReactNetworkImageRequest; import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.views.image.ImageResizeMode; -import com.facebook.react.views.text.TextInlineImageSpan; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; /** * FrescoBasedTextInlineImageSpan is a span for Images that are inside . It computes its size diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/ReactTextInlineImageShadowNode.java similarity index 84% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/ReactTextInlineImageShadowNode.java index 9e011bade6bffe..dbb409dc06b8ce 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/ReactTextInlineImageShadowNode.java @@ -5,9 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal; import com.facebook.react.uimanager.LayoutShadowNode; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; import com.facebook.yoga.YogaNode; /** Base class for {@link YogaNode}s that represent inline images. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLetterSpacingSpan.java similarity index 95% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLetterSpacingSpan.java index f037ef1881450f..6de79326400c55 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLetterSpacingSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.TextPaint; import android.text.style.MetricAffectingSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.java similarity index 97% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.java index 67ede6245a1ea2..682a7dd3ddcb69 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomLineHeightSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.graphics.Paint; import android.text.style.LineHeightSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.java similarity index 96% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.java index 1bcbb6f919f05c..5ec7e645385952 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.content.res.AssetManager; import android.graphics.Paint; @@ -16,6 +16,7 @@ import com.facebook.infer.annotation.Nullsafe; import com.facebook.react.common.ReactConstants; import com.facebook.react.common.assets.ReactFontManager; +import com.facebook.react.views.text.ReactTypefaceUtils; @Nullsafe(Nullsafe.Mode.LOCAL) public class CustomStyleSpan extends MetricAffectingSpan implements ReactSpan { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactAbsoluteSizeSpan.java similarity index 89% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactAbsoluteSizeSpan.java index 073a57c21139a0..460bcd20c6a5b3 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactAbsoluteSizeSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.style.AbsoluteSizeSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactBackgroundColorSpan.java similarity index 89% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactBackgroundColorSpan.java index 0954a0f8bc8c97..a04f2439dffe64 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactBackgroundColorSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.style.BackgroundColorSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.java similarity index 88% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.java index 3b71d0b1366a50..8aba070b1d210f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactClickableSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.TextPaint; import android.text.style.ClickableSpan; @@ -14,6 +14,8 @@ import com.facebook.react.bridge.ReactContext; import com.facebook.react.uimanager.UIManagerHelper; import com.facebook.react.uimanager.events.EventDispatcher; +import com.facebook.react.views.text.ReactTextView; +import com.facebook.react.views.text.TextLayoutManager; import com.facebook.react.views.view.ViewGroupClickEvent; /** @@ -36,11 +38,11 @@ * accessible (TalkBack announces that the text has links available, and the links are exposed in * the context menu). */ -class ReactClickableSpan extends ClickableSpan implements ReactSpan { +public class ReactClickableSpan extends ClickableSpan implements ReactSpan { private final int mReactTag; - ReactClickableSpan(int reactTag) { + public ReactClickableSpan(int reactTag) { mReactTag = reactTag; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactForegroundColorSpan.java similarity index 89% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactForegroundColorSpan.java index 3aebde60799b97..0a7b489b9230c3 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactForegroundColorSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.style.ForegroundColorSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactSpan.java similarity index 88% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactSpan.java index c847a92cb373d8..1b47e63d19bf7e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; /* * Enables us to distinguish between spans that were added by React Native and spans that were diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactStrikethroughSpan.java similarity index 88% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactStrikethroughSpan.java index 5c5eae7bfbf1fc..d2164156b1818a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactStrikethroughSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.style.StrikethroughSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactTagSpan.java similarity index 91% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactTagSpan.java index 535fd9757f53c4..04497ba19954e2 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactTagSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; /** * Instances of this class are used to place reactTag information of nested text react nodes into diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactUnderlineSpan.java similarity index 87% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactUnderlineSpan.java index f625dfc8d4fe08..7676230f0b6c51 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactUnderlineSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.style.UnderlineSpan; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/SetSpanOperation.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/SetSpanOperation.java similarity index 90% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/SetSpanOperation.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/SetSpanOperation.java index 57649508d54316..40b523268cc14f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/SetSpanOperation.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/SetSpanOperation.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.Spannable; import android.text.SpannableStringBuilder; @@ -17,9 +17,10 @@ public class SetSpanOperation { static final int SPAN_MAX_PRIORITY = Spanned.SPAN_PRIORITY >> Spanned.SPAN_PRIORITY_SHIFT; protected int start, end; - protected ReactSpan what; - SetSpanOperation(int start, int end, ReactSpan what) { + private final ReactSpan what; + + public SetSpanOperation(int start, int end, ReactSpan what) { this.start = start; this.end = end; this.what = what; @@ -56,4 +57,8 @@ public void execute(SpannableStringBuilder sb, int priorityIndex) { sb.setSpan(what, start, end, spanFlags); } + + public ReactSpan getWhat() { + return what; + } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ShadowStyleSpan.java similarity index 92% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ShadowStyleSpan.java index 4fe4bf958201e7..63325f32638b12 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ShadowStyleSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.text.TextPaint; import android.text.style.CharacterStyle; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineImageSpan.java similarity index 97% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineImageSpan.java index 6d674ebba9b419..34638cefd1d87e 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineImageSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.graphics.drawable.Drawable; import android.text.Spannable; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineViewPlaceholderSpan.java similarity index 96% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineViewPlaceholderSpan.java index 3b0196ecd52ecc..acb9c93c63b890 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextInlineViewPlaceholderSpan.java @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.views.text; +package com.facebook.react.views.text.internal.span; import android.graphics.Canvas; import android.graphics.Paint; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 39e53d255fa3df..f2b3e5d28c93bf 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -52,20 +52,20 @@ import com.facebook.react.uimanager.StateWrapper; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.events.EventDispatcher; -import com.facebook.react.views.text.CustomLetterSpacingSpan; -import com.facebook.react.views.text.CustomLineHeightSpan; -import com.facebook.react.views.text.CustomStyleSpan; -import com.facebook.react.views.text.ReactAbsoluteSizeSpan; -import com.facebook.react.views.text.ReactBackgroundColorSpan; -import com.facebook.react.views.text.ReactForegroundColorSpan; -import com.facebook.react.views.text.ReactSpan; -import com.facebook.react.views.text.ReactStrikethroughSpan; import com.facebook.react.views.text.ReactTextUpdate; import com.facebook.react.views.text.ReactTypefaceUtils; -import com.facebook.react.views.text.ReactUnderlineSpan; import com.facebook.react.views.text.TextAttributes; -import com.facebook.react.views.text.TextInlineImageSpan; import com.facebook.react.views.text.TextLayoutManager; +import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan; +import com.facebook.react.views.text.internal.span.CustomLineHeightSpan; +import com.facebook.react.views.text.internal.span.CustomStyleSpan; +import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan; +import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan; +import com.facebook.react.views.text.internal.span.ReactSpan; +import com.facebook.react.views.text.internal.span.ReactStrikethroughSpan; +import com.facebook.react.views.text.internal.span.ReactUnderlineSpan; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; import com.facebook.react.views.view.ReactViewBackgroundManager; import java.util.ArrayList; import java.util.Objects; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 74b881401ef2e0..0915a49a0bb214 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -69,10 +69,10 @@ import com.facebook.react.views.text.ReactTextViewManagerCallback; import com.facebook.react.views.text.ReactTypefaceUtils; import com.facebook.react.views.text.TextAttributeProps; -import com.facebook.react.views.text.TextInlineImageSpan; import com.facebook.react.views.text.TextLayoutManager; import com.facebook.react.views.text.TextLayoutManagerMapBuffer; import com.facebook.react.views.text.TextTransform; +import com.facebook.react.views.text.internal.span.TextInlineImageSpan; import com.facebook.yoga.YogaConstants; import java.lang.reflect.Field; import java.util.HashMap; diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.kt index aea7de47db71d8..f55c90af78de44 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.kt @@ -8,6 +8,7 @@ package com.facebook.react.views.text import android.graphics.Paint +import com.facebook.react.views.text.internal.span.CustomLineHeightSpan import org.assertj.core.api.Assertions.assertThat import org.junit.Test import org.junit.runner.RunWith