Skip to content

Commit d5399dd

Browse files
NickGerlemanmeta-codesync[bot]
authored andcommitted
Remove LayoutShadowNode descendants and use LayoutShadowNode directly (#55482)
Summary: Pull Request resolved: #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
1 parent f67f6a2 commit d5399dd

10 files changed

Lines changed: 27 additions & 695 deletions

File tree

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -6061,49 +6061,6 @@ public final class com/facebook/react/views/text/DefaultStyleValuesUtil {
60616061
public static final fun getTextColorSecondary (Landroid/content/Context;)Landroid/content/res/ColorStateList;
60626062
}
60636063

6064-
public abstract class com/facebook/react/views/text/ReactBaseTextShadowNode : com/facebook/react/uimanager/LayoutShadowNode {
6065-
public static final field Companion Lcom/facebook/react/views/text/ReactBaseTextShadowNode$Companion;
6066-
public static final field DEFAULT_TEXT_SHADOW_COLOR I
6067-
public static final field PROP_SHADOW_COLOR Ljava/lang/String;
6068-
public static final field PROP_SHADOW_OFFSET Ljava/lang/String;
6069-
public static final field PROP_SHADOW_OFFSET_HEIGHT Ljava/lang/String;
6070-
public static final field PROP_SHADOW_OFFSET_WIDTH Ljava/lang/String;
6071-
public static final field PROP_SHADOW_RADIUS Ljava/lang/String;
6072-
public static final field PROP_TEXT_TRANSFORM Ljava/lang/String;
6073-
public fun <init> ()V
6074-
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
6075-
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6076-
protected final fun getReactTextViewManagerCallback ()Lcom/facebook/react/views/text/ReactTextViewManagerCallback;
6077-
public final fun setAccessibilityRole (Ljava/lang/String;)V
6078-
public final fun setAdjustFontSizeToFit (Z)V
6079-
public final fun setAllowFontScaling (Z)V
6080-
public final fun setBackgroundColor (Ljava/lang/Integer;)V
6081-
public final fun setColor (Ljava/lang/Integer;)V
6082-
public final fun setFontFamily (Ljava/lang/String;)V
6083-
public final fun setFontSize (F)V
6084-
public final fun setFontStyle (Ljava/lang/String;)V
6085-
public final fun setFontVariant (Lcom/facebook/react/bridge/ReadableArray;)V
6086-
public final fun setFontWeight (Ljava/lang/String;)V
6087-
public final fun setIncludeFontPadding (Z)V
6088-
public final fun setLetterSpacing (F)V
6089-
public final fun setLineHeight (F)V
6090-
public final fun setMaxFontSizeMultiplier (F)V
6091-
public final fun setMinimumFontScale (F)V
6092-
public final fun setNumberOfLines (I)V
6093-
protected final fun setReactTextViewManagerCallback (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
6094-
public final fun setRole (Ljava/lang/String;)V
6095-
public final fun setTextAlign (Ljava/lang/String;)V
6096-
public fun setTextBreakStrategy (Ljava/lang/String;)V
6097-
public final fun setTextDecorationLine (Ljava/lang/String;)V
6098-
public final fun setTextShadowColor (I)V
6099-
public final fun setTextShadowOffset (Lcom/facebook/react/bridge/ReadableMap;)V
6100-
public final fun setTextShadowRadius (F)V
6101-
public final fun setTextTransform (Ljava/lang/String;)V
6102-
}
6103-
6104-
public final class com/facebook/react/views/text/ReactBaseTextShadowNode$Companion {
6105-
}
6106-
61076064
public final class com/facebook/react/views/text/ReactFontManager {
61086065
public static final field Companion Lcom/facebook/react/views/text/ReactFontManager$Companion;
61096066
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 {
61206077
public final fun getInstance ()Lcom/facebook/react/views/text/ReactFontManager;
61216078
}
61226079

6123-
public final class com/facebook/react/views/text/ReactTextShadowNode : com/facebook/react/views/text/ReactBaseTextShadowNode {
6124-
public fun <init> ()V
6125-
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
6126-
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6127-
public fun calculateLayoutOnChildren ()Ljava/lang/Iterable;
6128-
public fun hoistNativeChildren ()Z
6129-
public fun isVirtualAnchor ()Z
6130-
public fun markUpdated ()V
6131-
public fun onBeforeLayout (Lcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)V
6132-
public fun onCollectExtraUpdates (Lcom/facebook/react/uimanager/UIViewOperationQueue;)V
6133-
public final fun setShouldNotifyOnTextLayout (Z)V
6134-
}
6135-
61366080
public class com/facebook/react/views/text/ReactTextView : androidx/appcompat/widget/AppCompatTextView, com/facebook/react/uimanager/ReactCompoundView {
61376081
public fun <init> (Landroid/content/Context;)V
61386082
protected fun dispatchHoverEvent (Landroid/view/MotionEvent;)Z
@@ -6174,9 +6118,9 @@ public final class com/facebook/react/views/text/ReactTextViewManager : com/face
61746118
public fun <init> ()V
61756119
public fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
61766120
public synthetic fun <init> (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6121+
public fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/LayoutShadowNode;
61776122
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
6178-
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactTextShadowNode;
6179-
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/views/text/ReactTextShadowNode;
6123+
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/uimanager/LayoutShadowNode;
61806124
public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
61816125
public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/text/ReactTextView;
61826126
public fun getExportedCustomDirectEventTypeConstants ()Ljava/util/Map;
@@ -6416,9 +6360,9 @@ public class com/facebook/react/views/textinput/ReactTextInputManager : com/face
64166360
public fun <init> ()V
64176361
public synthetic fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)V
64186362
protected fun addEventEmitters (Lcom/facebook/react/uimanager/ThemedReactContext;Lcom/facebook/react/views/textinput/ReactEditText;)V
6363+
public fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/LayoutShadowNode;
64196364
public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode;
6420-
public fun createShadowNodeInstance ()Lcom/facebook/react/views/text/ReactBaseTextShadowNode;
6421-
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/views/text/ReactBaseTextShadowNode;
6365+
public final fun createShadowNodeInstance (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)Lcom/facebook/react/uimanager/LayoutShadowNode;
64226366
public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
64236367
public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/textinput/ReactEditText;
64246368
public fun getCommandsMap ()Ljava/util/Map;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.kt

Lines changed: 0 additions & 81 deletions
This file was deleted.

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
@file:Suppress("DEPRECATION")
9+
810
package com.facebook.react.views.progressbar
911

1012
import android.content.Context
@@ -16,6 +18,7 @@ import com.facebook.react.bridge.ReadableMap
1618
import com.facebook.react.common.ReactConstants
1719
import com.facebook.react.module.annotations.ReactModule
1820
import com.facebook.react.uimanager.BaseViewManager
21+
import com.facebook.react.uimanager.LayoutShadowNode
1922
import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel
2023
import com.facebook.react.uimanager.ThemedReactContext
2124
import com.facebook.react.uimanager.ViewManagerDelegate
@@ -33,10 +36,9 @@ import java.util.WeakHashMap
3336
* a [ProgressBar] changes, we have to drop the existing [ProgressBar] (if there is one) and create
3437
* a new one with the style given.
3538
*/
36-
@Suppress("DEPRECATION")
3739
@ReactModule(name = ReactProgressBarViewManager.REACT_CLASS)
3840
internal class ReactProgressBarViewManager :
39-
BaseViewManager<ProgressBarContainerView, ProgressBarShadowNode>(),
41+
BaseViewManager<ProgressBarContainerView, LayoutShadowNode>(),
4042
AndroidProgressBarManagerInterface<ProgressBarContainerView> {
4143
@Suppress("IDENTITY_SENSITIVE_OPERATIONS_WITH_VALUE_TYPE")
4244
private val measuredStyles = WeakHashMap<Int, Pair<Int, Int>>()
@@ -82,10 +84,9 @@ internal class ReactProgressBarViewManager :
8284
@ReactProp(name = PROP_ATTR)
8385
override fun setTypeAttr(view: ProgressBarContainerView, value: String?): Unit = Unit
8486

85-
override fun createShadowNodeInstance(): ProgressBarShadowNode = ProgressBarShadowNode()
87+
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
8688

87-
override fun getShadowNodeClass(): Class<ProgressBarShadowNode> =
88-
ProgressBarShadowNode::class.java
89+
override fun getShadowNodeClass(): Class<LayoutShadowNode> = LayoutShadowNode::class.java
8990

9091
override fun updateExtraData(root: ProgressBarContainerView, extraData: Any) {
9192
// do nothing

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
@file:Suppress("DEPRECATION")
9+
810
package com.facebook.react.views.switchview
911

1012
import android.content.Context
@@ -14,6 +16,7 @@ import androidx.annotation.ColorInt
1416
import com.facebook.react.bridge.ReactContext
1517
import com.facebook.react.bridge.ReadableMap
1618
import com.facebook.react.uimanager.BaseViewManager
19+
import com.facebook.react.uimanager.LayoutShadowNode
1720
import com.facebook.react.uimanager.PixelUtil
1821
import com.facebook.react.uimanager.ThemedReactContext
1922
import com.facebook.react.uimanager.UIManagerHelper
@@ -25,19 +28,16 @@ import com.facebook.react.viewmanagers.AndroidSwitchManagerInterface
2528
import com.facebook.yoga.YogaMeasureMode
2629
import com.facebook.yoga.YogaMeasureOutput
2730

28-
@Suppress("DEPRECATION")
2931
internal class ReactSwitchManager :
30-
BaseViewManager<ReactSwitch, ReactSwitchShadowNode>(),
31-
AndroidSwitchManagerInterface<ReactSwitch> {
32+
BaseViewManager<ReactSwitch, LayoutShadowNode>(), AndroidSwitchManagerInterface<ReactSwitch> {
3233

3334
private val delegate: ViewManagerDelegate<ReactSwitch> = AndroidSwitchManagerDelegate(this)
3435

3536
override fun getName(): String = REACT_CLASS
3637

37-
override fun createShadowNodeInstance(): ReactSwitchShadowNode = ReactSwitchShadowNode()
38+
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
3839

39-
override fun getShadowNodeClass(): Class<ReactSwitchShadowNode> =
40-
ReactSwitchShadowNode::class.java
40+
override fun getShadowNodeClass(): Class<LayoutShadowNode> = LayoutShadowNode::class.java
4141

4242
override fun createViewInstance(context: ThemedReactContext): ReactSwitch =
4343
ReactSwitch(context).apply { showText = false }

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchShadowNode.kt

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)