diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index b76548b510bd4a..140189a369b3fe 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -7740,35 +7740,6 @@ public class com/facebook/react/views/text/ReactTypefaceUtils { public static fun parseFontWeight (Ljava/lang/String;)I } -public class com/facebook/react/views/text/ReactVirtualTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode { - public fun ()V - public fun isVirtual ()Z -} - -public class com/facebook/react/views/text/ReactVirtualTextShadowNode$$PropsSetter : com/facebook/react/uimanager/ViewManagerPropertyUpdater$ShadowNodeSetter { - public fun ()V - public fun getProperties (Ljava/util/Map;)V - public synthetic fun setProperty (Lcom/facebook/react/uimanager/ReactShadowNode;Ljava/lang/String;Ljava/lang/Object;)V - public fun setProperty (Lcom/facebook/react/views/text/ReactVirtualTextShadowNode;Ljava/lang/String;Ljava/lang/Object;)V -} - -public class com/facebook/react/views/text/ReactVirtualTextViewManager : com/facebook/react/uimanager/BaseViewManager { - public fun ()V - public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode; - public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactVirtualTextShadowNode; - public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View; - public fun getName ()Ljava/lang/String; - public fun getShadowNodeClass ()Ljava/lang/Class; - public fun updateExtraData (Landroid/view/View;Ljava/lang/Object;)V -} - -public class com/facebook/react/views/text/ReactVirtualTextViewManager$$PropsSetter : com/facebook/react/uimanager/ViewManagerPropertyUpdater$ViewManagerSetter { - public fun ()V - public fun getProperties (Ljava/util/Map;)V - public synthetic fun setProperty (Lcom/facebook/react/uimanager/ViewManager;Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V - 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/TextAttributeProps { public static final field TA_KEY_ACCESSIBILITY_ROLE S public static final field TA_KEY_ALIGNMENT S diff --git a/packages/react-native/ReactAndroid/gradle.properties b/packages/react-native/ReactAndroid/gradle.properties index 6c3ec6535d733d..926482749db85c 100644 --- a/packages/react-native/ReactAndroid/gradle.properties +++ b/packages/react-native/ReactAndroid/gradle.properties @@ -9,6 +9,8 @@ react.internal.disableJavaVersionAlignment=true # Binary Compatibility Validator properties binaryCompatibilityValidator.ignoredClasses=com.facebook.react.BuildConfig,\ +com.facebook.react.views.text.ReactVirtualTextShadowNode$$PropsSetter,\ +com.facebook.react.views.text.ReactVirtualTextViewManager$$PropsSetter,\ com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager$$PropsSetter binaryCompatibilityValidator.ignoredPackages=com.facebook.debug,\ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java deleted file mode 100644 index 421a9e8c7b4257..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.text; - -import android.view.View; -import com.facebook.react.common.annotations.VisibleForTesting; -import com.facebook.react.module.annotations.ReactModule; -import com.facebook.react.uimanager.BaseViewManager; -import com.facebook.react.uimanager.ThemedReactContext; - -/** - * Manages raw text nodes. Since they are used only as a virtual nodes any type of native view - * operation will throw an {@link IllegalStateException} - */ -@ReactModule(name = ReactVirtualTextViewManager.REACT_CLASS) -public class ReactVirtualTextViewManager extends BaseViewManager { - - @VisibleForTesting public static final String REACT_CLASS = "RCTVirtualText"; - - @Override - public String getName() { - return REACT_CLASS; - } - - @Override - public View createViewInstance(ThemedReactContext context) { - throw new IllegalStateException("Attempt to create a native view for RCTVirtualText"); - } - - @Override - public void updateExtraData(View view, Object extraData) {} - - @Override - public Class getShadowNodeClass() { - return ReactVirtualTextShadowNode.class; - } - - @Override - public ReactVirtualTextShadowNode createShadowNodeInstance() { - return new ReactVirtualTextShadowNode(); - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt new file mode 100644 index 00000000000000..1ee05de1789188 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt @@ -0,0 +1,38 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.views.text + +import android.view.View +import com.facebook.react.module.annotations.ReactModule +import com.facebook.react.uimanager.BaseViewManager +import com.facebook.react.uimanager.ThemedReactContext + +/** + * Manages raw text nodes. Since they are used only as a virtual nodes any type of native view + * operation will throw an [IllegalStateException] + */ +@ReactModule(name = ReactVirtualTextViewManager.REACT_CLASS) +internal class ReactVirtualTextViewManager : BaseViewManager() { + + public override fun getName(): String = REACT_CLASS + + protected override fun createViewInstance(context: ThemedReactContext): View { + throw IllegalStateException("Attempt to create a native view for RCTVirtualText") + } + + public override fun updateExtraData(view: View, extraData: Any): Unit {} + + public override fun getShadowNodeClass(): Class = + ReactVirtualTextShadowNode::class.java + + override fun createShadowNodeInstance(): ReactVirtualTextShadowNode = ReactVirtualTextShadowNode() + + internal companion object { + public const val REACT_CLASS: String = "RCTVirtualText" + } +}