From da74d5da2cac5306e37368c65490c434e7ff9f4f Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sat, 9 Aug 2025 04:39:35 -0700 Subject: [PATCH] Deprecate Legacy Architecture ViewManagers (#53107) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53107 Deprecate Legacy Architecture ViewManagers, these classes are not used as part of the new architecture and will be deleted in the future changelog: [Android][Changed] Deprecate Legacy Architecture ViewManagers, these classes are not used as part of the new architecture and will be deleted in the future Reviewed By: shwanton Differential Revision: D79676585 fbshipit-source-id: 72cb6fe0bbe666cfa317cf28d6aec475f1c38c35 --- .../facebook/react/shell/MainReactPackage.kt | 17 ++++++++++------- .../react/views/text/ReactRawTextManager.kt | 3 +++ .../views/text/ReactVirtualTextViewManager.kt | 3 +++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt index 2089157dc49..9b6734c7d30 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt @@ -56,9 +56,7 @@ import com.facebook.react.views.scroll.ReactScrollViewManager import com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager import com.facebook.react.views.switchview.ReactSwitchManager import com.facebook.react.views.text.PreparedLayoutTextViewManager -import com.facebook.react.views.text.ReactRawTextManager import com.facebook.react.views.text.ReactTextViewManager -import com.facebook.react.views.text.ReactVirtualTextViewManager import com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager import com.facebook.react.views.textinput.ReactTextInputManager import com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager @@ -133,6 +131,7 @@ constructor(private val config: MainPackageConfig? = null) : else -> null } + @Suppress("DEPRECATION") override fun createViewManagers(reactContext: ReactApplicationContext): List> = listOf( ReactDrawerLayoutManager(), @@ -147,18 +146,19 @@ constructor(private val config: MainPackageConfig? = null) : FrescoBasedReactTextInlineImageViewManager(), ReactImageManager(), ReactModalHostManager(), - ReactRawTextManager(), + com.facebook.react.views.text.ReactRawTextManager(), ReactTextInputManager(), if (ReactNativeFeatureFlags.enablePreparedTextLayout()) PreparedLayoutTextViewManager() else ReactTextViewManager(), ReactViewManager(), - ReactVirtualTextViewManager(), + com.facebook.react.views.text.ReactVirtualTextViewManager(), ReactUnimplementedViewManager()) /** * A map of view managers that should be registered with * [com.facebook.react.uimanager.UIManagerModule] */ + @Suppress("DEPRECATION") @SuppressLint("VisibleForTests") public val viewManagersMap: Map = mapOf( @@ -182,7 +182,8 @@ constructor(private val config: MainPackageConfig? = null) : ReactImageManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactImageManager() }, ReactModalHostManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactModalHostManager() }, - ReactRawTextManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactRawTextManager() }, + com.facebook.react.views.text.ReactRawTextManager.REACT_CLASS to + ModuleSpec.viewManagerSpec { com.facebook.react.views.text.ReactRawTextManager() }, ReactTextInputManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactTextInputManager() }, ReactTextViewManager.REACT_CLASS to @@ -192,8 +193,10 @@ constructor(private val config: MainPackageConfig? = null) : else ReactTextViewManager() }, ReactViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactViewManager() }, - ReactVirtualTextViewManager.REACT_CLASS to - ModuleSpec.viewManagerSpec { ReactVirtualTextViewManager() }, + com.facebook.react.views.text.ReactVirtualTextViewManager.REACT_CLASS to + ModuleSpec.viewManagerSpec { + com.facebook.react.views.text.ReactVirtualTextViewManager() + }, ReactUnimplementedViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactUnimplementedViewManager() }) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt index b5451365425..e0f517c211c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.kt @@ -22,6 +22,9 @@ import com.facebook.react.uimanager.ViewManager */ @ReactModule(name = ReactRawTextManager.REACT_CLASS) @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 ReactRawTextManager : ViewManager() { override fun getName(): String { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt index 9a7a9c480c2..947869fa115 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.kt @@ -22,6 +22,9 @@ import com.facebook.react.uimanager.ThemedReactContext @Suppress("DEPRECATION") @ReactModule(name = ReactVirtualTextViewManager.REACT_CLASS) @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 ReactVirtualTextViewManager : BaseViewManager() { override fun getName(): String = REACT_CLASS