Migrate ReactRawTextShadowNode to Kotlin (#50234)

Summary:
Migrate com.facebook.react.views.text.ReactRawTextShadowNode to Kotlin.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.views.text.ReactRawTextShadowNode to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/50234

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: rshest

Differential Revision: D71803869

Pulled By: javache

fbshipit-source-id: dba9eea7aa8453b9372cbeb54a7f86b35fd30905
This commit is contained in:
Mateo Guzmán
2025-03-25 14:46:06 -07:00
committed by Facebook GitHub Bot
parent cbd2ee55ef
commit 175c969148
3 changed files with 31 additions and 52 deletions
@@ -6713,11 +6713,11 @@ public final class com/facebook/react/views/text/ReactRawTextManager : com/faceb
public fun updateExtraData (Landroid/view/View;Ljava/lang/Object;)V
}
public class com/facebook/react/views/text/ReactRawTextShadowNode : com/facebook/react/uimanager/ReactShadowNodeImpl {
public final class com/facebook/react/views/text/ReactRawTextShadowNode : com/facebook/react/uimanager/ReactShadowNodeImpl {
public fun <init> ()V
public fun getText ()Ljava/lang/String;
public final fun getText ()Ljava/lang/String;
public fun isVirtual ()Z
public fun setText (Ljava/lang/String;)V
public final fun setText (Ljava/lang/String;)V
public fun toString ()Ljava/lang/String;
}
@@ -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 + "]";
}
}
@@ -0,0 +1,28 @@
/*
* 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.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 = "text")
public var text: String? = null
set(value) {
field = value
markUpdated()
}
override fun isVirtual(): Boolean = true
override fun toString(): String = "$viewClass [text: $text]"
}