Remove LayoutShadowNode descendants and use LayoutShadowNode directly (#55482)

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

This change removes all descendant ShadowNode classes of LayoutShadowNode in ReactAndroid as part of the ongoing Legacy Architecture cleanup. These ShadowNode classes were deprecated and marked for removal.

Deleted classes:
- ProgressBarShadowNode
- ReactSwitchShadowNode
- ReactTextInlineImageShadowNode
- ReactBaseTextShadowNode
- ReactTextShadowNode
- ReactTextInputShadowNode

All usages in ViewManager classes have been updated to use LayoutShadowNode directly instead of these specialized subclasses.

# Changelog
[Android][Removed] - Remove Deprecated ProgressBarShadowNode
[Android][Removed] - Remove  Deprecated ReactSwitchShadowNode
[Android][Removed] - Remove  Deprecated ReactTextInlineImageShadowNode
[Android][Removed] - Remove  Deprecated ReactBaseTextShadowNode
[Android][Removed] - Remove  Deprecated ReactTextShadowNode
[Android][Removed] - Remove  Deprecated ReactTextInputShadowNode

Reviewed By: mdvacca

Differential Revision: D92646479

fbshipit-source-id: 59e3d73edbde0960476747891a9c1cba6a5114de
This commit is contained in:
Nick Gerleman authored and meta-codesync[bot] committed 2026-02-09 22:33:05 -08:00
1 parent f67f6a2448
commit d5399dd40d
10 files changed
+27 -695

No files matched your search

@@ -6061,49 +6061,6 @@ public final class com/facebook/react/views/text/DefaultStyleValuesUtil {
public static final fun getTextColorSecondary (Landroid/content/Context;)Landroid/content/res/ColorStateList;
}
public abstract class com/facebook/react/views/text/ReactBaseTextShadowNode : com/facebook/react/uimanager/LayoutShadowNode {
public static final field Companion Lcom/facebook/react/views/text/ReactBaseTextShadowNode$Companion;
public static final field DEFAULT_TEXT_SHADOW_COLOR I
public static final field PROP_SHADOW_COLOR Ljava/lang/String;
public static final field PROP_SHADOW_OFFSET Ljava/lang/String;
public static final field PROP_SHADOW_OFFSET_HEIGHT Ljava/lang/String;
public static final field PROP_SHADOW_OFFSET_WIDTH Ljava/lang/String;
public static final field PROP_SHADOW_RADIUS Ljava/lang/String;
public static final field PROP_TEXT_TRANSFORM Ljava/lang/String;
public fun <init> ()V
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
protected final fun getReactTextViewManagerCallback ()Lcom/facebook/react/views/text/ReactTextViewManagerCallback;
public final fun setAccessibilityRole (Ljava/lang/String;)V
public final fun setAdjustFontSizeToFit (Z)V
public final fun setAllowFontScaling (Z)V
public final fun setBackgroundColor (Ljava/lang/Integer;)V
public final fun setColor (Ljava/lang/Integer;)V
public final fun setFontFamily (Ljava/lang/String;)V
public final fun setFontSize (F)V
public final fun setFontStyle (Ljava/lang/String;)V
public final fun setFontVariant (Lcom/facebook/react/bridge/ReadableArray;)V
public final fun setFontWeight (Ljava/lang/String;)V
public final fun setIncludeFontPadding (Z)V
public final fun setLetterSpacing (F)V
public final fun setLineHeight (F)V
public final fun setMaxFontSizeMultiplier (F)V
public final fun setMinimumFontScale (F)V
public final fun setNumberOfLines (I)V
protected final fun setReactTextViewManagerCallback (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
public final fun setRole (Ljava/lang/String;)V
public final fun setTextAlign (Ljava/lang/String;)V
public fun setTextBreakStrategy (Ljava/lang/String;)V
public final fun setTextDecorationLine (Ljava/lang/String;)V
public final fun setTextShadowColor (I)V
public final fun setTextShadowOffset (Lcom/facebook/react/bridge/ReadableMap;)V
public final fun setTextShadowRadius (F)V
public final fun setTextTransform (Ljava/lang/String;)V
}
public final class com/facebook/react/views/text/ReactBaseTextShadowNode$Companion {
}
public final class com/facebook/react/views/text/ReactFontManager {
public static final field Companion Lcom/facebook/react/views/text/ReactFontManager$Companion;
public synthetic fun <init> (Lcom/facebook/react/common/assets/ReactFontManager;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
@@ -6120,19 +6077,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/ReactTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode {
public fun <init> ()V
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun calculateLayoutOnChildren ()Ljava/lang/Iterable;
public fun hoistNativeChildren ()Z
public fun isVirtualAnchor ()Z
public fun markUpdated ()V
public fun onBeforeLayout (Lcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)V
public fun onCollectExtraUpdates (Lcom/facebook/react/uimanager/UIViewOperationQueue;)V
public final fun setShouldNotifyOnTextLayout (Z)V
}
public class com/facebook/react/views/text/ReactTextView : androidx/appcompat/widget/AppCompatTextView, com/facebook/react/uimanager/ReactCompoundView {
public fun <init> (Landroid/content/Context;)V
protected fun dispatchHoverEvent (Landroid/view/MotionEvent;)Z
@@ -6174,9 +6118,9 @@ public final class com/facebook/react/views/text/ReactTextViewManager : com/face
public fun <init> ()V
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/LayoutShadowNode;
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactTextShadowNode;
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/views/text/ReactTextShadowNode;
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/uimanager/LayoutShadowNode;
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 getExportedCustomDirectEventTypeConstants ()Ljava/util/Map;
@@ -6416,9 +6360,9 @@ public class com/facebook/react/views/textinput/ReactTextInputManager : com/face
public fun <init> ()V
public synthetic fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)V
protected fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Lcom/facebook/react/views/textinput/ReactEditText;)V
public fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/LayoutShadowNode;
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactBaseTextShadowNode;
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/views/text/ReactBaseTextShadowNode;
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/uimanager/LayoutShadowNode;
public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/textinput/ReactEditText;
public fun getCommandsMap ()Ljava/util/Map;
@@ -1,81 +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.progressbar
import android.util.SparseIntArray
import android.view.View
import android.view.ViewGroup
import com.facebook.react.common.annotations.LegacyArchitectureShadowNodeWithCxxImpl
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.yoga.YogaMeasureFunction
import com.facebook.yoga.YogaMeasureMode
import com.facebook.yoga.YogaMeasureOutput
import com.facebook.yoga.YogaNode
/**
* Node responsible for holding the style of the ProgressBar, see under [ ] for possible styles.
* ReactProgressBarViewManager manages how this style is applied to the ProgressBar.
*/
@Suppress("DEPRECATION")
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@LegacyArchitectureShadowNodeWithCxxImpl
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING,
)
internal class ProgressBarShadowNode :
com.facebook.react.uimanager.LayoutShadowNode(), YogaMeasureFunction {
private val height: SparseIntArray = SparseIntArray()
private val width: SparseIntArray = SparseIntArray()
private val measured: MutableSet<Int> = HashSet()
init {
setMeasureFunction(this)
}
@set:ReactProp(name = ReactProgressBarViewManager.PROP_STYLE)
var style: String? = ReactProgressBarViewManager.DEFAULT_STYLE
set(value) {
field = value ?: ReactProgressBarViewManager.DEFAULT_STYLE
}
override fun measure(
node: YogaNode,
width: Float,
widthMode: YogaMeasureMode,
height: Float,
heightMode: YogaMeasureMode,
): Long {
val style = ReactProgressBarViewManager.getStyleFromString(style)
if (!measured.contains(style)) {
val progressBar = ReactProgressBarViewManager.createProgressBar(themedContext, style)
val spec =
View.MeasureSpec.makeMeasureSpec(
ViewGroup.LayoutParams.WRAP_CONTENT,
View.MeasureSpec.UNSPECIFIED,
)
progressBar.measure(spec, spec)
this.height.put(style, progressBar.measuredHeight)
this.width.put(style, progressBar.measuredWidth)
measured.add(style)
}
return YogaMeasureOutput.make(this.width[style], this.height[style])
}
companion object {
init {
LegacyArchitectureLogger.assertLegacyArchitecture(
"ProgressBarShadowNode",
LegacyArchitectureLogLevel.ERROR,
)
}
}
}
@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.views.progressbar
import android.content.Context
@@ -16,6 +18,7 @@ import com.facebook.react.bridge.ReadableMap
import com.facebook.react.common.ReactConstants
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.BaseViewManager
import com.facebook.react.uimanager.LayoutShadowNode
import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewManagerDelegate
@@ -33,10 +36,9 @@ import java.util.WeakHashMap
* a [ProgressBar] changes, we have to drop the existing [ProgressBar] (if there is one) and create
* a new one with the style given.
*/
@Suppress("DEPRECATION")
@ReactModule(name = ReactProgressBarViewManager.REACT_CLASS)
internal class ReactProgressBarViewManager :
BaseViewManager<ProgressBarContainerView, ProgressBarShadowNode>(),
BaseViewManager<ProgressBarContainerView, LayoutShadowNode>(),
AndroidProgressBarManagerInterface<ProgressBarContainerView> {
@Suppress("IDENTITY_SENSITIVE_OPERATIONS_WITH_VALUE_TYPE")
private val measuredStyles = WeakHashMap<Int, Pair<Int, Int>>()
@@ -82,10 +84,9 @@ internal class ReactProgressBarViewManager :
@ReactProp(name = PROP_ATTR)
override fun setTypeAttr(view: ProgressBarContainerView, value: String?): Unit = Unit
override fun createShadowNodeInstance(): ProgressBarShadowNode = ProgressBarShadowNode()
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
override fun getShadowNodeClass(): Class<ProgressBarShadowNode> =
ProgressBarShadowNode::class.java
override fun getShadowNodeClass(): Class<LayoutShadowNode> = LayoutShadowNode::class.java
override fun updateExtraData(root: ProgressBarContainerView, extraData: Any) {
// do nothing
@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.views.switchview
import android.content.Context
@@ -14,6 +16,7 @@ import androidx.annotation.ColorInt
import com.facebook.react.bridge.ReactContext
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.uimanager.BaseViewManager
import com.facebook.react.uimanager.LayoutShadowNode
import com.facebook.react.uimanager.PixelUtil
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.UIManagerHelper
@@ -25,19 +28,16 @@ import com.facebook.react.viewmanagers.AndroidSwitchManagerInterface
import com.facebook.yoga.YogaMeasureMode
import com.facebook.yoga.YogaMeasureOutput
@Suppress("DEPRECATION")
internal class ReactSwitchManager :
BaseViewManager<ReactSwitch, ReactSwitchShadowNode>(),
AndroidSwitchManagerInterface<ReactSwitch> {
BaseViewManager<ReactSwitch, LayoutShadowNode>(), AndroidSwitchManagerInterface<ReactSwitch> {
private val delegate: ViewManagerDelegate<ReactSwitch> = AndroidSwitchManagerDelegate(this)
override fun getName(): String = REACT_CLASS
override fun createShadowNodeInstance(): ReactSwitchShadowNode = ReactSwitchShadowNode()
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
override fun getShadowNodeClass(): Class<ReactSwitchShadowNode> =
ReactSwitchShadowNode::class.java
override fun getShadowNodeClass(): Class<LayoutShadowNode> = LayoutShadowNode::class.java
override fun createViewInstance(context: ThemedReactContext): ReactSwitch =
ReactSwitch(context).apply { showText = false }
@@ -1,72 +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.switchview
import android.view.View
import com.facebook.react.common.annotations.LegacyArchitectureShadowNodeWithCxxImpl
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
import com.facebook.yoga.YogaMeasureFunction
import com.facebook.yoga.YogaMeasureMode
import com.facebook.yoga.YogaMeasureOutput
import com.facebook.yoga.YogaNode
@Suppress("DEPRECATION")
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING,
)
@LegacyArchitectureShadowNodeWithCxxImpl
internal class ReactSwitchShadowNode :
com.facebook.react.uimanager.LayoutShadowNode(), YogaMeasureFunction {
private var width = 0
private var height = 0
private var measured = false
init {
initMeasureFunction()
}
private fun initMeasureFunction() {
setMeasureFunction(this)
}
override fun measure(
node: YogaNode,
width: Float,
widthMode: YogaMeasureMode,
height: Float,
heightMode: YogaMeasureMode,
): Long {
if (!measured) {
// Create a switch with the default config and measure it; since we don't (currently)
// support setting custom switch text, this is fine, as all switches will measure the same
// on a specific device/theme/locale combination.
val reactSwitch = ReactSwitch(themedContext)
reactSwitch.showText = false
val spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
reactSwitch.measure(spec, spec)
this.width = reactSwitch.measuredWidth
this.height = reactSwitch.measuredHeight
measured = true
}
return YogaMeasureOutput.make(this.width, this.height)
}
companion object {
init {
LegacyArchitectureLogger.assertLegacyArchitecture(
"ReactSwitchShadowNode",
LegacyArchitectureLogLevel.ERROR,
)
}
}
}
@@ -1,245 +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.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.views.text
import android.text.Spannable
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.common.ReactConstants
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
import com.facebook.react.uimanager.LayoutShadowNode
import com.facebook.react.uimanager.ReactShadowNode
import com.facebook.react.uimanager.ViewProps
import com.facebook.react.uimanager.annotations.ReactProp
/**
* [ReactShadowNode] abstract class for spannable text nodes.
*
* This class handles all text attributes associated with `<Text>`-ish node. A concrete node can be
* an anchor `<Text>` node, an anchor `<TextInput>` node or virtual `<Text>` node inside `<Text>` or
* `<TextInput>` node. Or even something else.
*
* This also node calculates [Spannable] object based on sub nodes of the same type, which can be
* used in concrete classes to feed native views and compute layout.
*/
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release"
)
public abstract class ReactBaseTextShadowNode
@JvmOverloads
public constructor(
protected var reactTextViewManagerCallback: ReactTextViewManagerCallback? = null
) : LayoutShadowNode() {
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.NUMBER_OF_LINES, defaultInt = ReactConstants.UNSET)
public fun setNumberOfLines(numberOfLines: Int) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.LINE_HEIGHT, defaultFloat = Float.NaN)
public fun setLineHeight(lineHeight: Float) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.LETTER_SPACING, defaultFloat = 0f)
public fun setLetterSpacing(letterSpacing: Float) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.ALLOW_FONT_SCALING, defaultBoolean = true)
public fun setAllowFontScaling(allowFontScaling: Boolean) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.MAX_FONT_SIZE_MULTIPLIER, defaultFloat = Float.NaN)
public fun setMaxFontSizeMultiplier(maxFontSizeMultiplier: Float) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.TEXT_ALIGN)
public fun setTextAlign(textAlign: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.FONT_SIZE, defaultFloat = Float.NaN)
public fun setFontSize(fontSize: Float) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.COLOR, customType = "Color")
public fun setColor(color: Int?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.BACKGROUND_COLOR, customType = "Color")
public fun setBackgroundColor(color: Int?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.ACCESSIBILITY_ROLE)
public fun setAccessibilityRole(accessibilityRole: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.ROLE)
public fun setRole(role: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.FONT_FAMILY)
public fun setFontFamily(fontFamily: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.FONT_WEIGHT)
public fun setFontWeight(fontWeightString: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.FONT_VARIANT)
public fun setFontVariant(fontVariantArray: ReadableArray?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.FONT_STYLE)
public fun setFontStyle(fontStyleString: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.INCLUDE_FONT_PADDING, defaultBoolean = true)
public fun setIncludeFontPadding(includepad: Boolean) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.TEXT_DECORATION_LINE)
public fun setTextDecorationLine(textDecorationLineString: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.TEXT_BREAK_STRATEGY)
public open fun setTextBreakStrategy(textBreakStrategy: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = PROP_SHADOW_OFFSET)
public fun setTextShadowOffset(offsetMap: ReadableMap?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = PROP_SHADOW_RADIUS, defaultInt = 1)
public fun setTextShadowRadius(textShadowRadius: Float) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = PROP_SHADOW_COLOR, defaultInt = DEFAULT_TEXT_SHADOW_COLOR, customType = "Color")
public fun setTextShadowColor(textShadowColor: Int) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = PROP_TEXT_TRANSFORM)
public fun setTextTransform(textTransform: String?) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.ADJUSTS_FONT_SIZE_TO_FIT)
public fun setAdjustFontSizeToFit(adjustsFontSizeToFit: Boolean) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = ViewProps.MINIMUM_FONT_SCALE)
public fun setMinimumFontScale(minimumFontScale: Float) {
error(
"ReactBaseTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
public companion object {
public const val PROP_SHADOW_OFFSET: String = "textShadowOffset"
public const val PROP_SHADOW_OFFSET_WIDTH: String = "width"
public const val PROP_SHADOW_OFFSET_HEIGHT: String = "height"
public const val PROP_SHADOW_RADIUS: String = "textShadowRadius"
public const val PROP_SHADOW_COLOR: String = "textShadowColor"
public const val PROP_TEXT_TRANSFORM: String = "textTransform"
public const val DEFAULT_TEXT_SHADOW_COLOR: Int = 0x55000000
}
}
@@ -1,80 +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.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.views.text
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
import com.facebook.react.uimanager.NativeViewHierarchyOptimizer
import com.facebook.react.uimanager.ReactShadowNode
import com.facebook.react.uimanager.UIViewOperationQueue
import com.facebook.react.uimanager.annotations.ReactProp
/**
* [ReactBaseTextShadowNode] concrete class for anchor `Text` node.
*
* The class measures text in `<Text>` view and feeds native [TextView] using [Spannable] object
* constructed in superclass.
*/
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING,
)
public class ReactTextShadowNode
@JvmOverloads
public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? = null) :
ReactBaseTextShadowNode(reactTextViewManagerCallback) {
override fun isVirtualAnchor(): Boolean {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
override fun hoistNativeChildren(): Boolean {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
override fun markUpdated() {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun onBeforeLayout(nativeViewHierarchyOptimizer: NativeViewHierarchyOptimizer) {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun onCollectExtraUpdates(uiViewOperationQueue: UIViewOperationQueue) {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "onTextLayout")
public fun setShouldNotifyOnTextLayout(shouldNotifyOnTextLayout: Boolean) {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
override fun calculateLayoutOnChildren(): Iterable<ReactShadowNode<*>?>? {
error(
"ReactTextShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
}
@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.views.text
import android.os.Build
@@ -25,6 +27,7 @@ import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.BackgroundStyleApplicator
import com.facebook.react.uimanager.BaseViewManager
import com.facebook.react.uimanager.IViewManagerWithChildren
import com.facebook.react.uimanager.LayoutShadowNode
import com.facebook.react.uimanager.LengthPercentage
import com.facebook.react.uimanager.LengthPercentageType
import com.facebook.react.uimanager.ReactStylesDiffMap
@@ -41,7 +44,6 @@ import com.facebook.react.views.text.DefaultStyleValuesUtil.getDefaultTextColorH
import java.util.HashMap
/** View manager for `<Text>` nodes. */
@Suppress("DEPRECATION")
@ReactModule(name = ReactTextViewManager.REACT_CLASS)
@OptIn(UnstableReactNativeAPI::class)
public class ReactTextViewManager
@@ -49,7 +51,7 @@ public class ReactTextViewManager
public constructor(
protected var reactTextViewManagerCallback: ReactTextViewManagerCallback? = null
) :
BaseViewManager<ReactTextView, ReactTextShadowNode>(),
BaseViewManager<ReactTextView, LayoutShadowNode>(),
IViewManagerWithChildren,
ReactTextViewManagerCallback {
init {
@@ -108,14 +110,13 @@ public constructor(
}
}
override fun createShadowNodeInstance(): ReactTextShadowNode =
ReactTextShadowNode(reactTextViewManagerCallback)
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
public fun createShadowNodeInstance(
reactTextViewManagerCallback: ReactTextViewManagerCallback?
): ReactTextShadowNode = ReactTextShadowNode(reactTextViewManagerCallback)
): LayoutShadowNode = LayoutShadowNode()
override fun getShadowNodeClass(): Class<ReactTextShadowNode> = ReactTextShadowNode::class.java
override fun getShadowNodeClass(): Class<LayoutShadowNode> = LayoutShadowNode::class.java
override fun onAfterUpdateTransaction(view: ReactTextView) {
super.onAfterUpdateTransaction(view)
@@ -66,7 +66,6 @@ import com.facebook.react.views.scroll.ScrollEventType.Companion.getJSEventName
import com.facebook.react.views.text.DefaultStyleValuesUtil.getDefaultTextColor
import com.facebook.react.views.text.DefaultStyleValuesUtil.getDefaultTextColorHighlight
import com.facebook.react.views.text.DefaultStyleValuesUtil.getDefaultTextColorHint
import com.facebook.react.views.text.ReactBaseTextShadowNode
import com.facebook.react.views.text.ReactTextUpdate
import com.facebook.react.views.text.ReactTextUpdate.Companion.buildReactTextUpdateFromState
import com.facebook.react.views.text.ReactTextViewManagerCallback
@@ -100,14 +99,13 @@ public open class ReactTextInputManager public constructor() :
return editText
}
override fun createShadowNodeInstance(): ReactBaseTextShadowNode = ReactTextInputShadowNode()
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
public fun createShadowNodeInstance(
reactTextViewManagerCallback: ReactTextViewManagerCallback?
): ReactBaseTextShadowNode = ReactTextInputShadowNode(reactTextViewManagerCallback)
): LayoutShadowNode = LayoutShadowNode()
override fun getShadowNodeClass(): Class<out LayoutShadowNode> =
ReactTextInputShadowNode::class.java
override fun getShadowNodeClass(): Class<out LayoutShadowNode> = LayoutShadowNode::class.java
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
val baseEventTypeConstants = super.getExportedCustomBubblingEventTypeConstants()
@@ -326,7 +324,7 @@ public open class ReactTextInputManager public constructor() :
}
// Sets the letter spacing as an absolute point size.
// This extra handling, on top of what ReactBaseTextShadowNode already does, is required for the
// This extra handling is required for the
// correct display of spacing in placeholder (hint) text.
@ReactProp(name = ViewProps.LETTER_SPACING, defaultFloat = 0f)
public fun setLetterSpacing(view: ReactEditText, letterSpacing: Float) {
@@ -1,134 +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.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.views.textinput
import com.facebook.react.common.annotations.LegacyArchitectureShadowNodeWithCxxImpl
import com.facebook.react.common.annotations.internal.LegacyArchitecture
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.UIViewOperationQueue
import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.react.views.text.ReactBaseTextShadowNode
import com.facebook.react.views.text.ReactTextViewManagerCallback
import com.facebook.yoga.YogaMeasureFunction
import com.facebook.yoga.YogaMeasureMode
import com.facebook.yoga.YogaNode
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@LegacyArchitectureShadowNodeWithCxxImpl
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING,
)
internal class ReactTextInputShadowNode
@JvmOverloads
constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? = null) :
ReactBaseTextShadowNode(reactTextViewManagerCallback), YogaMeasureFunction {
@Suppress("UNUSED_PARAMETER")
@set:ReactProp(name = PROP_TEXT)
var text: String? = null
set(_) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@set:ReactProp(name = PROP_PLACEHOLDER)
var placeholder: String? = null
set(_) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun setThemedContext(themedContext: ThemedReactContext) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun measure(
node: YogaNode,
width: Float,
widthMode: YogaMeasureMode,
height: Float,
heightMode: YogaMeasureMode,
): Long {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
override fun isVirtualAnchor(): Boolean {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
override fun isYogaLeafNode(): Boolean {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun setLocalData(data: Any) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
@ReactProp(name = "mostRecentEventCount")
public fun setMostRecentEventCount(mostRecentEventCount: Int) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun setTextBreakStrategy(textBreakStrategy: String?) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun onCollectExtraUpdates(uiViewOperationQueue: UIViewOperationQueue) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
@Suppress("UNUSED_PARAMETER")
override fun setPadding(spacingType: Int, padding: Float) {
error(
"ReactTextInputShadowNode methods are unsupported, and the ShadowNode will be fully removed in a future version of React Native."
)
}
companion object {
const val PROP_TEXT: String = "text"
const val PROP_PLACEHOLDER: String = "placeholder"
init {
LegacyArchitectureLogger.assertLegacyArchitecture(
"ReactTextInputShadowNode",
LegacyArchitectureLogLevel.ERROR,
)
}
}
}