diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java deleted file mode 100644 index e43e43b5ef40..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java +++ /dev/null @@ -1,49 +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 androidx.annotation.Nullable; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.react.common.annotations.VisibleForTesting; -import com.facebook.react.uimanager.ReactShadowNode; -import com.facebook.react.uimanager.ReactShadowNodeImpl; -import com.facebook.react.uimanager.annotations.ReactProp; - -/** - * {@link ReactShadowNode} class for pure raw text node (aka {@code textContent} in terms of DOM). - * Raw text node can only have simple string value without any attributes, properties or state. - */ -@Nullsafe(Nullsafe.Mode.LOCAL) -public class ReactRawTextShadowNode extends ReactShadowNodeImpl { - - @VisibleForTesting public static final String PROP_TEXT = "text"; - - private @Nullable String mText = null; - - public ReactRawTextShadowNode() {} - - @ReactProp(name = PROP_TEXT) - public void setText(@Nullable String text) { - mText = text; - markUpdated(); - } - - public @Nullable String getText() { - return mText; - } - - @Override - public boolean isVirtual() { - return true; - } - - @Override - public String toString() { - return getViewClass() + " [text: " + mText + "]"; - } -} 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 new file mode 100644 index 000000000000..97e69da8a05a --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.kt @@ -0,0 +1,34 @@ +/* + * 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 com.facebook.react.common.annotations.VisibleForTesting +import com.facebook.react.uimanager.ReactShadowNodeImpl +import com.facebook.react.uimanager.annotations.ReactProp + +/** + * [ReactShadowNode] class for pure raw text node (aka `textContent` in terms of DOM). + * Raw text node can only have simple string value without any attributes, properties or state. + */ +public class ReactRawTextShadowNode : ReactShadowNodeImpl() { + @set:ReactProp(name = PROP_TEXT) + public var text: String? = null + set(value) { + field = value + markUpdated() + } + + override fun isVirtual(): Boolean = true + + override fun toString(): String = "$viewClass [text: $text]" + + public companion object { + @VisibleForTesting + public const val PROP_TEXT: String = "text" + } +}