mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Deprecate Legacy Architecture UIManagerModules class (#53122)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53122 Deprecate LegacyArchitecture UIManagerModules class changelog: [Android][Changed] Deprecate LegacyArchitecture UIManagerModules class Reviewed By: mlord93 Differential Revision: D79672294 fbshipit-source-id: 8a22df4a4341a2ab501fc003ee213fb0047847fc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7f5b2b8f84
commit
85610c8b43
+9
-7
@@ -30,7 +30,6 @@ import com.facebook.react.modules.debug.DevSettingsModule
|
||||
import com.facebook.react.modules.debug.SourceCodeModule
|
||||
import com.facebook.react.modules.deviceinfo.DeviceInfoModule
|
||||
import com.facebook.react.modules.systeminfo.AndroidInfoModule
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.uimanager.ViewManager
|
||||
import com.facebook.react.uimanager.ViewManagerResolver
|
||||
import com.facebook.systrace.Systrace
|
||||
@@ -53,7 +52,7 @@ import com.facebook.systrace.Systrace
|
||||
HeadlessJsTaskSupportModule::class,
|
||||
SourceCodeModule::class,
|
||||
TimingModule::class,
|
||||
UIManagerModule::class])
|
||||
com.facebook.react.uimanager.UIManagerModule::class])
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Suppress("DEPRECATION")
|
||||
internal class CoreModulesPackage(
|
||||
@@ -103,7 +102,7 @@ internal class CoreModulesPackage(
|
||||
HeadlessJsTaskSupportModule::class.java,
|
||||
SourceCodeModule::class.java,
|
||||
TimingModule::class.java,
|
||||
UIManagerModule::class.java,
|
||||
com.facebook.react.uimanager.UIManagerModule::class.java,
|
||||
)
|
||||
|
||||
val reactModuleInfoMap: MutableMap<String, ReactModuleInfo> = HashMap<String, ReactModuleInfo>()
|
||||
@@ -140,7 +139,7 @@ internal class CoreModulesPackage(
|
||||
HeadlessJsTaskSupportModule.NAME -> HeadlessJsTaskSupportModule(reactContext)
|
||||
SourceCodeModule.NAME -> SourceCodeModule(reactContext)
|
||||
TimingModule.NAME -> TimingModule(reactContext, reactInstanceManager.devSupportManager)
|
||||
UIManagerModule.NAME -> createUIManager(reactContext)
|
||||
com.facebook.react.uimanager.UIManagerModule.NAME -> createUIManager(reactContext)
|
||||
DeviceInfoModule.NAME -> DeviceInfoModule(reactContext)
|
||||
else ->
|
||||
throw IllegalArgumentException(
|
||||
@@ -148,7 +147,9 @@ internal class CoreModulesPackage(
|
||||
}
|
||||
}
|
||||
|
||||
private fun createUIManager(reactContext: ReactApplicationContext): UIManagerModule {
|
||||
private fun createUIManager(
|
||||
reactContext: ReactApplicationContext
|
||||
): com.facebook.react.uimanager.UIManagerModule {
|
||||
ReactMarker.logMarker(ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_START)
|
||||
Systrace.beginSection(Systrace.TRACE_TAG_REACT, "createUIManagerModule")
|
||||
|
||||
@@ -165,9 +166,10 @@ internal class CoreModulesPackage(
|
||||
}
|
||||
}
|
||||
|
||||
return UIManagerModule(reactContext, resolver, minTimeLeftInFrameForNonBatchedOperationMs)
|
||||
return com.facebook.react.uimanager.UIManagerModule(
|
||||
reactContext, resolver, minTimeLeftInFrameForNonBatchedOperationMs)
|
||||
} else {
|
||||
return UIManagerModule(
|
||||
return com.facebook.react.uimanager.UIManagerModule(
|
||||
reactContext,
|
||||
reactInstanceManager.getOrCreateViewManagers(reactContext),
|
||||
minTimeLeftInFrameForNonBatchedOperationMs)
|
||||
|
||||
+6
-6
@@ -28,7 +28,6 @@ import com.facebook.react.modules.core.ReactChoreographer
|
||||
import com.facebook.react.uimanager.GuardedFrameCallback
|
||||
import com.facebook.react.uimanager.UIBlock
|
||||
import com.facebook.react.uimanager.UIManagerHelper
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.uimanager.common.UIManagerType
|
||||
import com.facebook.react.uimanager.common.ViewUtil
|
||||
import java.util.ArrayList
|
||||
@@ -74,9 +73,9 @@ import kotlin.concurrent.Volatile
|
||||
* that coordinates all the action: [NativeAnimatedNodesManager]. Since all the methods from
|
||||
* [NativeAnimatedNodesManager] need to be called from the UI thread, we we create a queue of
|
||||
* animated graph operations that is then enqueued to be executed in the UI Thread at the end of the
|
||||
* batch of JS->native calls (similarly to how it's handled in [UIManagerModule]). This isolates us
|
||||
* from the problems that may be caused by concurrent updates of animated graph while UI thread is
|
||||
* "executing" the animation loop.
|
||||
* batch of JS->native calls (similarly to how it's handled in
|
||||
* [com.facebook.react.uimanager.UIManagerModule]). This isolates us from the problems that may be
|
||||
* caused by concurrent updates of animated graph while UI thread is "executing" the animation loop.
|
||||
*/
|
||||
@OptIn(UnstableReactNativeAPI::class)
|
||||
@ReactModule(name = NativeAnimatedModuleSpec.NAME)
|
||||
@@ -306,6 +305,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) :
|
||||
}
|
||||
|
||||
// For non-FabricUIManager only
|
||||
@Suppress("DEPRECATION")
|
||||
@UiThread
|
||||
override fun willDispatchViewUpdates(uiManager: UIManager) {
|
||||
if (operations.isEmpty && preOperations.isEmpty) {
|
||||
@@ -325,8 +325,8 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext) :
|
||||
|
||||
val operationsUIBlock = UIBlock { operations.executeBatch(frameNo, nodesManager) }
|
||||
|
||||
assert(uiManager is UIManagerModule)
|
||||
val uiManagerModule = uiManager as UIManagerModule
|
||||
assert(uiManager is com.facebook.react.uimanager.UIManagerModule)
|
||||
val uiManagerModule = uiManager as com.facebook.react.uimanager.UIManagerModule
|
||||
uiManagerModule.prependUIBlock(preOperationsUIBlock)
|
||||
uiManagerModule.addUIBlock(operationsUIBlock)
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,7 +11,6 @@ import android.view.Choreographer
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.UiThreadUtil
|
||||
import com.facebook.react.common.build.ReactBuildConfig
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
|
||||
/**
|
||||
* Each time a frame is drawn, records whether it should have expected any more callbacks since the
|
||||
@@ -62,7 +61,8 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
|
||||
// removeBridgeIdleDebugListener for Bridgeless
|
||||
@Suppress("DEPRECATION")
|
||||
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
|
||||
val uiManagerModule = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
val uiManagerModule =
|
||||
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
|
||||
if (!reactContext.isBridgeless) {
|
||||
reactContext.catalystInstance.addBridgeIdleDebugListener(didJSUpdateUiDuringFrameDetector)
|
||||
isRunningOnFabric = false
|
||||
@@ -83,7 +83,8 @@ internal class FpsDebugFrameCallback(private val reactContext: ReactContext) :
|
||||
fun stop() {
|
||||
@Suppress("DEPRECATION")
|
||||
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE) {
|
||||
val uiManagerModule = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
val uiManagerModule =
|
||||
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
|
||||
if (!reactContext.isBridgeless) {
|
||||
reactContext.catalystInstance.removeBridgeIdleDebugListener(
|
||||
didJSUpdateUiDuringFrameDetector)
|
||||
|
||||
+2
-2
@@ -61,7 +61,6 @@ import com.facebook.react.runtime.internal.bolts.Task
|
||||
import com.facebook.react.runtime.internal.bolts.TaskCompletionSource
|
||||
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.uimanager.events.BlackHoleEventDispatcher
|
||||
import com.facebook.react.uimanager.events.EventDispatcher
|
||||
import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper
|
||||
@@ -523,9 +522,10 @@ public class ReactHostImpl(
|
||||
internal val nativeModules: Collection<NativeModule>
|
||||
get() = reactInstance?.nativeModules ?: listOf()
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
internal fun <T : NativeModule> getNativeModule(nativeModuleInterface: Class<T>): T? {
|
||||
if (!ReactBuildConfig.UNSTABLE_ENABLE_MINIFY_LEGACY_ARCHITECTURE &&
|
||||
nativeModuleInterface == UIManagerModule::class.java) {
|
||||
nativeModuleInterface == com.facebook.react.uimanager.UIManagerModule::class.java) {
|
||||
ReactSoftExceptionLogger.logSoftExceptionVerbose(
|
||||
TAG,
|
||||
ReactNoCrashSoftException(
|
||||
|
||||
+2
@@ -5,6 +5,8 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.facebook.react.uimanager
|
||||
|
||||
import android.util.SparseArray
|
||||
|
||||
+2
@@ -88,6 +88,8 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
*/
|
||||
@ReactModule(name = UIManagerModule.NAME)
|
||||
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
|
||||
@Deprecated(
|
||||
since = "This class is part of Legacy Architecture and will be removed in a future release")
|
||||
public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
implements OnBatchCompleteListener, LifecycleEventListener, UIManager {
|
||||
static {
|
||||
|
||||
+2
@@ -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
|
||||
|
||||
+2
-2
@@ -19,7 +19,6 @@ import com.facebook.react.common.build.ReactBuildConfig
|
||||
import com.facebook.react.uimanager.PixelUtil.pxToDp
|
||||
import com.facebook.react.uimanager.StateWrapper
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
|
||||
internal class ReactSafeAreaView(val reactContext: ThemedReactContext) : ViewGroup(reactContext) {
|
||||
internal var stateWrapper: StateWrapper? = null
|
||||
@@ -39,6 +38,7 @@ internal class ReactSafeAreaView(val reactContext: ThemedReactContext) : ViewGro
|
||||
|
||||
override fun onLayout(p0: Boolean, p1: Int, p2: Int, p3: Int, p4: Int): Unit = Unit
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@UiThread
|
||||
private fun updateState(insets: Insets) {
|
||||
val sw = stateWrapper
|
||||
@@ -57,7 +57,7 @@ internal class ReactSafeAreaView(val reactContext: ThemedReactContext) : ViewGro
|
||||
object : GuardedRunnable(reactContext) {
|
||||
override fun runGuarded() {
|
||||
this@ReactSafeAreaView.reactContext.reactApplicationContext
|
||||
.getNativeModule(UIManagerModule::class.java)
|
||||
.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
|
||||
?.updateInsetsPadding(id, insets.top, insets.left, insets.bottom, insets.right)
|
||||
}
|
||||
})
|
||||
|
||||
+2
-2
@@ -63,7 +63,6 @@ import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel
|
||||
import com.facebook.react.uimanager.ReactAccessibilityDelegate
|
||||
import com.facebook.react.uimanager.StateWrapper
|
||||
import com.facebook.react.uimanager.UIManagerHelper
|
||||
import com.facebook.react.uimanager.UIManagerModule
|
||||
import com.facebook.react.uimanager.common.UIManagerType
|
||||
import com.facebook.react.uimanager.common.ViewUtil.getUIManagerType
|
||||
import com.facebook.react.uimanager.events.EventDispatcher
|
||||
@@ -850,7 +849,8 @@ public open class ReactEditText public constructor(context: Context) : AppCompat
|
||||
@Suppress("DEPRECATION")
|
||||
if (stateWrapper == null && !reactContext.isBridgeless) {
|
||||
val localData = ReactTextInputLocalData(this)
|
||||
val uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
|
||||
val uiManager =
|
||||
reactContext.getNativeModule(com.facebook.react.uimanager.UIManagerModule::class.java)
|
||||
uiManager?.setViewLocalData(id, localData)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user