Skip to content

Commit c4a5eea

Browse files
committed
Deprecate Legacy Architecture ShadowNode classes
Differential Revision: D79672295
1 parent 934fba4 commit c4a5eea

File tree

14 files changed

+36
-11
lines changed

14 files changed

+36
-11
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManagerDelegate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import com.facebook.yoga.YogaConstants
2020
* every view should support, such as rotation, background color, etc.
2121
*/
2222
public abstract class BaseViewManagerDelegate<
23-
T : View, U : BaseViewManager<T, out LayoutShadowNode>>(
23+
T : View, @Suppress("DEPRECATION") U : BaseViewManager<T, out LayoutShadowNode>>(
2424
@Suppress("NoHungarianNotation") @JvmField protected val mViewManager: U
2525
) : ViewManagerDelegate<T> {
2626
@Suppress("ACCIDENTAL_OVERRIDE", "DEPRECATION")

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
* explored, namely using the VirtualText class in JS and setting the correct set of validAttributes
3939
*/
4040
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
41+
@Deprecated(
42+
since = "This class is part of Legacy Architecture and will be removed in a future release")
4143
public class LayoutShadowNode extends ReactShadowNodeImpl {
4244
static {
4345
LegacyArchitectureLogger.assertLegacyArchitecture(

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* NativeViewHierarchyOptimizer} for more information.
4747
*/
4848
@LegacyArchitecture
49+
@Deprecated(
50+
since = "This class is part of Legacy Architecture and will be removed in a future release")
4951
public interface ReactShadowNode<T extends ReactShadowNode> {
5052

5153
/**

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
*/
6161
@ReactPropertyHolder
6262
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
63+
@Deprecated(
64+
since = "This class is part of Legacy Architecture and will be removed in a future release")
6365
public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl> {
6466

6567
private static final YogaConfig sYogaConfig;

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import android.view.View
1717
*
1818
* @param <T> the view handled by this manager
1919
*/
20+
@Suppress("DEPRECATION")
2021
public abstract class SimpleViewManager<T : View> : BaseViewManager<T, LayoutShadowNode>() {
2122

2223
public override fun createShadowNodeInstance(): LayoutShadowNode {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.facebook.react.bridge.ReactApplicationContext
1313
import com.facebook.react.bridge.UiThreadUtil
1414
import java.util.WeakHashMap
1515

16+
@Suppress("DEPRECATION")
1617
public abstract class ViewGroupManager<T : ViewGroup>
1718
@JvmOverloads
1819
constructor(reactContext: ReactApplicationContext? = null) :

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.facebook.react.bridge.ReadableArray
1313
import com.facebook.react.uimanager.ViewManagersPropertyCache.PropSetter
1414
import java.util.HashMap
1515

16+
@Suppress("DEPRECATION")
1617
public object ViewManagerPropertyUpdater {
1718
public fun interface Settable {
1819
public fun getProperties(props: MutableMap<String, String>)
@@ -24,7 +25,7 @@ public object ViewManagerPropertyUpdater {
2425
}
2526

2627
@Suppress("FINITE_BOUNDS_VIOLATION_IN_JAVA")
27-
public interface ShadowNodeSetter<in T : ReactShadowNode<*>> : Settable {
28+
public interface ShadowNodeSetter<@Suppress("DEPRECATION") in T : ReactShadowNode<*>> : Settable {
2829
public fun setProperty(node: T, name: String, value: Any?)
2930
}
3031

@@ -71,7 +72,10 @@ public object ViewManagerPropertyUpdater {
7172

7273
@JvmStatic
7374
@Deprecated("Use ViewManager#updateProperties to update a view's properties")
74-
public fun <T : ReactShadowNode<T>> updateProps(node: T, props: ReactStylesDiffMap) {
75+
public fun <@Suppress("DEPRECATION") T : ReactShadowNode<T>> updateProps(
76+
node: T,
77+
props: ReactStylesDiffMap
78+
) {
7579
val setter = findNodeSetter(node.javaClass)
7680
val iterator = props.backingMap.entryIterator
7781
while (iterator.hasNext()) {
@@ -108,7 +112,7 @@ public object ViewManagerPropertyUpdater {
108112
return setter as ViewManagerSetter<ViewManager<V, *>, V>
109113
}
110114

111-
private fun <T : ReactShadowNode<T>> findNodeSetter(
115+
private fun <@Suppress("DEPRECATION") T : ReactShadowNode<T>> findNodeSetter(
112116
nodeClass: Class<out T>
113117
): ShadowNodeSetter<T> {
114118
var setter = SHADOW_NODE_SETTER_MAP[nodeClass]

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import com.facebook.react.common.annotations.LegacyArchitectureShadowNodeWithCxx
1414
import com.facebook.react.common.annotations.internal.LegacyArchitecture
1515
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
1616
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
17-
import com.facebook.react.uimanager.LayoutShadowNode
1817
import com.facebook.react.uimanager.annotations.ReactProp
1918
import com.facebook.yoga.YogaMeasureFunction
2019
import com.facebook.yoga.YogaMeasureMode
@@ -25,9 +24,11 @@ import com.facebook.yoga.YogaNode
2524
* Node responsible for holding the style of the ProgressBar, see under [ ] for possible styles.
2625
* ReactProgressBarViewManager manages how this style is applied to the ProgressBar.
2726
*/
27+
@Suppress("DEPRECATION")
2828
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
2929
@LegacyArchitectureShadowNodeWithCxxImpl
30-
internal class ProgressBarShadowNode : LayoutShadowNode(), YogaMeasureFunction {
30+
internal class ProgressBarShadowNode :
31+
com.facebook.react.uimanager.LayoutShadowNode(), YogaMeasureFunction {
3132
private val height: SparseIntArray = SparseIntArray()
3233
private val width: SparseIntArray = SparseIntArray()
3334
private val measured: MutableSet<Int> = HashSet()

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaViewManager.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package com.facebook.react.views.safeareaview
99

1010
import com.facebook.react.module.annotations.ReactModule
11-
import com.facebook.react.uimanager.LayoutShadowNode
1211
import com.facebook.react.uimanager.ReactStylesDiffMap
1312
import com.facebook.react.uimanager.StateWrapper
1413
import com.facebook.react.uimanager.ThemedReactContext
@@ -31,9 +30,13 @@ internal class ReactSafeAreaViewManager :
3130

3231
override fun getName(): String = REACT_CLASS
3332

34-
override fun createShadowNodeInstance(): LayoutShadowNode = LayoutShadowNode()
33+
@Suppress("DEPRECATION")
34+
override fun createShadowNodeInstance(): com.facebook.react.uimanager.LayoutShadowNode =
35+
com.facebook.react.uimanager.LayoutShadowNode()
3536

36-
override fun getShadowNodeClass(): Class<out LayoutShadowNode> = LayoutShadowNode::class.java
37+
@Suppress("DEPRECATION")
38+
override fun getShadowNodeClass(): Class<out com.facebook.react.uimanager.LayoutShadowNode> =
39+
com.facebook.react.uimanager.LayoutShadowNode::class.java
3740

3841
override fun updateState(
3942
view: ReactSafeAreaView,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ import com.facebook.react.common.annotations.LegacyArchitectureShadowNodeWithCxx
1212
import com.facebook.react.common.annotations.internal.LegacyArchitecture
1313
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
1414
import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
15-
import com.facebook.react.uimanager.LayoutShadowNode
1615
import com.facebook.yoga.YogaMeasureFunction
1716
import com.facebook.yoga.YogaMeasureMode
1817
import com.facebook.yoga.YogaMeasureOutput
1918
import com.facebook.yoga.YogaNode
2019

20+
@Suppress("DEPRECATION")
2121
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
2222
@LegacyArchitectureShadowNodeWithCxxImpl
23-
internal class ReactSwitchShadowNode : LayoutShadowNode(), YogaMeasureFunction {
23+
internal class ReactSwitchShadowNode :
24+
com.facebook.react.uimanager.LayoutShadowNode(), YogaMeasureFunction {
2425
private var width = 0
2526
private var height = 0
2627
private var measured = false

0 commit comments

Comments
 (0)