mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove deprecated UIImplementationProvider
Summary: UIImplementation(Provider) is not compatible with the new renderer (Fabric) and the relevant constructors have been marked deprecated for a while. While ReactInstanceManagerBuilder creates a default instance, it's not even used by CoreModulesPackage. Changelog: [Android][Removed] Removed deprecated UIImplementationProvider Reviewed By: NickGerleman Differential Revision: D39271916 fbshipit-source-id: 20a3b02843ea9a2ba4bfc1352037239febbafc64
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7b79dfccce
commit
e7d7563195
@@ -32,7 +32,6 @@ 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.turbomodule.core.interfaces.TurboModule;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.UIManagerModule;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.uimanager.ViewManagerResolver;
|
||||
@@ -70,7 +69,6 @@ public class CoreModulesPackage extends TurboReactPackage implements ReactPackag
|
||||
public CoreModulesPackage(
|
||||
ReactInstanceManager reactInstanceManager,
|
||||
DefaultHardwareBackBtnHandler hardwareBackBtnHandler,
|
||||
@Nullable UIImplementationProvider uiImplementationProvider,
|
||||
boolean lazyViewManagersEnabled,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
mReactInstanceManager = reactInstanceManager;
|
||||
|
||||
@@ -99,7 +99,6 @@ import com.facebook.react.turbomodule.core.TurboModuleManagerDelegate;
|
||||
import com.facebook.react.turbomodule.core.interfaces.TurboModuleRegistry;
|
||||
import com.facebook.react.uimanager.DisplayMetricsHolder;
|
||||
import com.facebook.react.uimanager.ReactRoot;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import com.facebook.react.uimanager.UIManagerHelper;
|
||||
import com.facebook.react.uimanager.ViewManager;
|
||||
import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper;
|
||||
@@ -225,7 +224,6 @@ public class ReactInstanceManager {
|
||||
boolean requireActivity,
|
||||
@Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
|
||||
LifecycleState initialLifecycleState,
|
||||
@Nullable UIImplementationProvider mUIImplementationProvider,
|
||||
JSExceptionHandler jSExceptionHandler,
|
||||
@Nullable RedBoxHandler redBoxHandler,
|
||||
boolean lazyViewManagersEnabled,
|
||||
@@ -282,7 +280,6 @@ public class ReactInstanceManager {
|
||||
ReactInstanceManager.this.invokeDefaultOnBackPressed();
|
||||
}
|
||||
},
|
||||
mUIImplementationProvider,
|
||||
lazyViewManagersEnabled,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs));
|
||||
if (mUseDeveloperSupport) {
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.facebook.react.jscexecutor.JSCExecutor;
|
||||
import com.facebook.react.jscexecutor.JSCExecutorFactory;
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
||||
import com.facebook.react.packagerconnection.RequestHandler;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -52,7 +51,6 @@ public class ReactInstanceManagerBuilder {
|
||||
private @Nullable DevSupportManagerFactory mDevSupportManagerFactory;
|
||||
private boolean mRequireActivity;
|
||||
private @Nullable LifecycleState mInitialLifecycleState;
|
||||
private @Nullable UIImplementationProvider mUIImplementationProvider;
|
||||
private @Nullable JSExceptionHandler mJSExceptionHandler;
|
||||
private @Nullable Activity mCurrentActivity;
|
||||
private @Nullable DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler;
|
||||
@@ -70,13 +68,6 @@ public class ReactInstanceManagerBuilder {
|
||||
|
||||
/* package protected */ ReactInstanceManagerBuilder() {}
|
||||
|
||||
/** Sets a provider of {@link UIImplementation}. Uses default provider if null is passed. */
|
||||
public ReactInstanceManagerBuilder setUIImplementationProvider(
|
||||
@Nullable UIImplementationProvider uiImplementationProvider) {
|
||||
mUIImplementationProvider = uiImplementationProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setJSIModulesPackage(
|
||||
@Nullable JSIModulePackage jsiModulePackage) {
|
||||
mJSIModulesPackage = jsiModulePackage;
|
||||
@@ -325,11 +316,6 @@ public class ReactInstanceManagerBuilder {
|
||||
mJSMainModulePath != null || mJSBundleAssetUrl != null || mJSBundleLoader != null,
|
||||
"Either MainModulePath or JS Bundle File needs to be provided");
|
||||
|
||||
if (mUIImplementationProvider == null) {
|
||||
// create default UIImplementationProvider if the provided one is null.
|
||||
mUIImplementationProvider = new UIImplementationProvider();
|
||||
}
|
||||
|
||||
// We use the name of the device and the app for debugging & metrics
|
||||
//noinspection ConstantConditions
|
||||
String appName = mApplication.getPackageName();
|
||||
@@ -355,7 +341,6 @@ public class ReactInstanceManagerBuilder {
|
||||
mRequireActivity,
|
||||
mBridgeIdleDebugListener,
|
||||
Assertions.assertNotNull(mInitialLifecycleState, "Initial lifecycle state was not set"),
|
||||
mUIImplementationProvider,
|
||||
mJSExceptionHandler,
|
||||
mRedBoxHandler,
|
||||
mLazyViewManagersEnabled,
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.facebook.react.common.SurfaceDelegate;
|
||||
import com.facebook.react.common.SurfaceDelegateFactory;
|
||||
import com.facebook.react.devsupport.DevSupportManagerFactory;
|
||||
import com.facebook.react.devsupport.interfaces.RedBoxHandler;
|
||||
import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -77,7 +76,6 @@ public abstract class ReactNativeHost {
|
||||
.setLazyViewManagersEnabled(getLazyViewManagersEnabled())
|
||||
.setRedBoxHandler(getRedBoxHandler())
|
||||
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
|
||||
.setUIImplementationProvider(getUIImplementationProvider())
|
||||
.setJSIModulesPackage(getJSIModulePackage())
|
||||
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
|
||||
.setReactPackageTurboModuleManagerDelegateBuilder(
|
||||
@@ -117,16 +115,6 @@ public abstract class ReactNativeHost {
|
||||
return mApplication;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link UIImplementationProvider} to use. Override this method if you want to use a
|
||||
* custom UI implementation.
|
||||
*
|
||||
* <p>Note: this is very advanced functionality, in 99% of cases you don't need to override this.
|
||||
*/
|
||||
protected UIImplementationProvider getUIImplementationProvider() {
|
||||
return new UIImplementationProvider();
|
||||
}
|
||||
|
||||
protected @Nullable JSIModulePackage getJSIModulePackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.facebook.systrace.SystraceMessage;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
import com.facebook.yoga.YogaDirection;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -65,30 +64,6 @@ public class UIImplementation {
|
||||
void onLayoutUpdated(ReactShadowNode root);
|
||||
}
|
||||
|
||||
public UIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerResolver viewManagerResolver,
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
this(
|
||||
reactContext,
|
||||
new ViewManagerRegistry(viewManagerResolver),
|
||||
eventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
|
||||
public UIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagers,
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
this(
|
||||
reactContext,
|
||||
new ViewManagerRegistry(viewManagers),
|
||||
eventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
|
||||
UIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerRegistry viewManagers,
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import java.util.List;
|
||||
|
||||
/** Provides UIImplementation to use in {@link UIManagerModule}. */
|
||||
@Deprecated
|
||||
public class UIImplementationProvider {
|
||||
|
||||
public UIImplementation createUIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerResolver viewManagerResolver,
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "UIImplementationProvider.createUIImplementation[1]");
|
||||
try {
|
||||
return new UIImplementation(
|
||||
reactContext,
|
||||
viewManagerResolver,
|
||||
eventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
public UIImplementation createUIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagerList,
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "UIImplementationProvider.createUIImplementation[2]");
|
||||
try {
|
||||
return new UIImplementation(
|
||||
reactContext,
|
||||
viewManagerList,
|
||||
eventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
UIImplementation createUIImplementation(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerRegistry viewManagerRegistry,
|
||||
EventDispatcher eventDispatcher,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "UIImplementationProvider.createUIImplementation[3]");
|
||||
try {
|
||||
return new UIImplementation(
|
||||
reactContext,
|
||||
viewManagerRegistry,
|
||||
eventDispatcher,
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,36 +115,10 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
private int mBatchId = 0;
|
||||
private int mNumRootViews = 0;
|
||||
|
||||
@SuppressWarnings("deprecated")
|
||||
public UIManagerModule(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerResolver viewManagerResolver,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
this(
|
||||
reactContext,
|
||||
viewManagerResolver,
|
||||
new UIImplementationProvider(),
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecated")
|
||||
public UIManagerModule(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagersList,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
this(
|
||||
reactContext,
|
||||
viewManagersList,
|
||||
new UIImplementationProvider(),
|
||||
minTimeLeftInFrameForNonBatchedOperationMs);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public UIManagerModule(
|
||||
ReactApplicationContext reactContext,
|
||||
ViewManagerResolver viewManagerResolver,
|
||||
UIImplementationProvider uiImplementationProvider,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
super(reactContext);
|
||||
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
|
||||
mEventDispatcher = new EventDispatcherImpl(reactContext);
|
||||
@@ -152,7 +126,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
mCustomDirectEvents = UIManagerModuleConstants.getDirectEventTypeConstants();
|
||||
mViewManagerRegistry = new ViewManagerRegistry(viewManagerResolver);
|
||||
mUIImplementation =
|
||||
uiImplementationProvider.createUIImplementation(
|
||||
new UIImplementation(
|
||||
reactContext,
|
||||
mViewManagerRegistry,
|
||||
mEventDispatcher,
|
||||
@@ -161,11 +135,9 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
reactContext.addLifecycleEventListener(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public UIManagerModule(
|
||||
ReactApplicationContext reactContext,
|
||||
List<ViewManager> viewManagersList,
|
||||
UIImplementationProvider uiImplementationProvider,
|
||||
int minTimeLeftInFrameForNonBatchedOperationMs) {
|
||||
super(reactContext);
|
||||
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
|
||||
@@ -174,7 +146,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
mModuleConstants = createConstants(viewManagersList, null, mCustomDirectEvents);
|
||||
mViewManagerRegistry = new ViewManagerRegistry(viewManagersList);
|
||||
mUIImplementation =
|
||||
uiImplementationProvider.createUIImplementation(
|
||||
new UIImplementation(
|
||||
reactContext,
|
||||
mViewManagerRegistry,
|
||||
mEventDispatcher,
|
||||
@@ -927,7 +899,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
|
||||
}
|
||||
|
||||
/** Listener that drops the CSSNode pool on low memory when the app is backgrounded. */
|
||||
private class MemoryTrimCallback implements ComponentCallbacks2 {
|
||||
private static class MemoryTrimCallback implements ComponentCallbacks2 {
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
|
||||
Reference in New Issue
Block a user