Deprecate LegacyArchitecture classes from package com.facebook.react.uimanager (#53120)

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

Deprecate com.facebook.react.uimanager classes

changelog: [Android][Changed] Deprecate LegacyArchitecture classes from package com.facebook.react.uimanager

Reviewed By: mlord93

Differential Revision: D79660036

fbshipit-source-id: 981f7938e54e40f810caec72fa485cc4a00029f6
This commit is contained in:
David Vacca
2025-08-08 02:52:36 -07:00
committed by Facebook GitHub Bot
parent 9831b03860
commit 39d24bade3
8 changed files with 28 additions and 2 deletions
@@ -14,6 +14,9 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
import com.facebook.yoga.YogaDirection
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
internal object LayoutDirectionUtil {
init {
LegacyArchitectureLogger.assertLegacyArchitecture(
@@ -14,6 +14,9 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
// - `kind == PARENT` checks whether the node can host children in the native tree.
// - `kind != NONE` checks whether the node appears in the native tree.
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
internal enum class NativeKind {
// Node is in the native hierarchy and the HierarchyOptimizer should assume it can host children
// (e.g. because it's a ViewGroup). Note that it's okay if the node doesn't support children. When
@@ -16,6 +16,9 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
* associated with it.
*/
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
internal class NoSuchNativeViewException(detailMessage: String) :
IllegalViewOperationException(detailMessage) {
@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.uimanager
import androidx.core.util.Pools.SynchronizedPool
@@ -20,6 +22,9 @@ import com.facebook.react.uimanager.events.Event
/** Event used to notify JS component about changes of its position or dimensions. */
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.WARNING)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
public class OnLayoutEvent private constructor() : Event<OnLayoutEvent>() {
@VisibleForTesting internal var x: Int = 0
@VisibleForTesting internal var y: Int = 0
@@ -20,6 +20,9 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
* UIManagerModule instance.
*/
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
internal class ShadowNodeRegistry {
private val tagsToCSSNodes = SparseArray<ReactShadowNode<*>>()
private val rootTags = SparseBooleanArray()
@@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
@file:Suppress("DEPRECATION")
package com.facebook.react.uimanager
import com.facebook.react.common.annotations.internal.LegacyArchitecture
@@ -17,6 +19,9 @@ import java.util.Objects
* operation.
*/
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
internal class ViewAtIndex(
@Suppress("NoHungarianNotation") @JvmField public val mTag: Int,
@Suppress("NoHungarianNotation") @JvmField public val mIndex: Int
@@ -15,6 +15,9 @@ import com.facebook.yoga.YogaNode
/** Static holder for a recycling pool of YogaNodes. */
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
@Deprecated(
message = "This class is part of Legacy Architecture and will be removed in a future release",
level = DeprecationLevel.WARNING)
internal object YogaNodePool {
init {
LegacyArchitectureLogger.assertLegacyArchitecture(
@@ -31,6 +31,7 @@ class OnLayoutEventTest {
val width = 100
val height = 200
@Suppress("DEPRECATION")
val event = OnLayoutEvent.obtain(surfaceId, viewTag, x, y, width, height)
assertThat(event).isNotNull
@@ -43,14 +44,14 @@ class OnLayoutEventTest {
@Test
fun testGetEventName_shouldReturnCorrectEventName() {
val event = OnLayoutEvent.obtain(1, 1, 10, 20, 100, 200)
@Suppress("DEPRECATION") val event = OnLayoutEvent.obtain(1, 1, 10, 20, 100, 200)
assertThat(event.getEventName()).isEqualTo("topLayout")
}
@Test
fun testInit_shouldCorrectlyInitializeValues() {
val event = OnLayoutEvent.obtain(1, 1, 10, 20, 100, 200)
@Suppress("DEPRECATION") val event = OnLayoutEvent.obtain(1, 1, 10, 20, 100, 200)
assertThat(event.surfaceId).isEqualTo(1)
assertThat(event.viewTag).isEqualTo(1)