From 788213f91accd38be90b53bca218cd6cd050daeb Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 8 Apr 2025 14:00:07 -0700 Subject: [PATCH] Make class internal - ReactRawText* (#50570) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50570 This diff makes the following file internal - ReactRawTextShadowNode and ReactRawTextManager as part of our ongoing effort of reducing the API surface. The only meaningful user of this API is this library: https://github.com/iyegoroff/react-native-text-gradient Which is umaintained (last supported version is RN 0.59) so I'm not considering this breaking. Changelog: [Android] [Changed] - Make ReactRawTextManager internal. We verified no popular libraries are impacted by this change Reviewed By: mdvacca Differential Revision: D72647702 fbshipit-source-id: 59a3646fdbc8f11907b4cf5056ff88c6dcec1cf8 --- .../ReactAndroid/api/ReactAndroid.api | 20 ------------------- .../react/views/text/ReactRawTextManager.kt | 12 +++++------ .../views/text/ReactRawTextShadowNode.kt | 4 ++-- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index fd759e8ca96..04b7a38e955 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -6556,26 +6556,6 @@ public final class com/facebook/react/views/text/ReactFontManager$Companion { public final fun getInstance ()Lcom/facebook/react/views/text/ReactFontManager; } -public final class com/facebook/react/views/text/ReactRawTextManager : com/facebook/react/uimanager/ViewManager { - public static final field REACT_CLASS Ljava/lang/String; - public fun ()V - public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode; - public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactRawTextShadowNode; - public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View; - public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/text/ReactTextView; - public fun getName ()Ljava/lang/String; - public fun getShadowNodeClass ()Ljava/lang/Class; - public fun updateExtraData (Landroid/view/View;Ljava/lang/Object;)V -} - -public final class com/facebook/react/views/text/ReactRawTextShadowNode : com/facebook/react/uimanager/ReactShadowNodeImpl { - public fun ()V - public final fun getText ()Ljava/lang/String; - public fun isVirtual ()Z - public final fun setText (Ljava/lang/String;)V - public fun toString ()Ljava/lang/String; -} - 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 diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt index 405bb1c6bec..b605c78b624 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt @@ -17,25 +17,25 @@ import com.facebook.react.uimanager.ViewManager * nodes, any type of native view operation will throw an [IllegalStateException]. */ @ReactModule(name = ReactRawTextManager.REACT_CLASS) -public class ReactRawTextManager : ViewManager() { +internal class ReactRawTextManager : ViewManager() { - public override fun getName(): String { + override fun getName(): String { return REACT_CLASS } public override fun createViewInstance(context: ThemedReactContext): ReactTextView = throw IllegalStateException("Attempt to create a native view for RCTRawText") - protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? = + override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? = throw IllegalStateException("Attempt to recycle a native view for RCTRawText") - public override fun updateExtraData(view: View, extraData: Any): Unit = Unit + override fun updateExtraData(view: View, extraData: Any): Unit = Unit - public override fun getShadowNodeClass(): Class { + override fun getShadowNodeClass(): Class { return ReactRawTextShadowNode::class.java } - public override fun createShadowNodeInstance(): ReactRawTextShadowNode { + override fun createShadowNodeInstance(): ReactRawTextShadowNode { return ReactRawTextShadowNode() } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.kt index b7797c8e985..c08b4bd79e1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.kt @@ -16,9 +16,9 @@ import com.facebook.react.uimanager.annotations.ReactProp * can only have simple string value without any attributes, properties or state. */ @LegacyArchitecture -public class ReactRawTextShadowNode : ReactShadowNodeImpl() { +internal class ReactRawTextShadowNode : ReactShadowNodeImpl() { @set:ReactProp(name = "text") - public var text: String? = null + var text: String? = null set(value) { field = value markUpdated()