Re-introduce UIImplementationProvider

Summary: UIImplementationProvider was removed as part of D8650376, this was a breaking change that caused problems in OSS. This diff introduces the concept of a deprecated UIImplementationProvider again to allow OSS community to upgrade to latest version of RN.

Reviewed By: achen1

Differential Revision: D10456317

fbshipit-source-id: 6817629524f927dfcb5ebc054dbfd983877b7606
This commit is contained in:
David Vacca
2018-10-20 11:24:55 -07:00
committed by Facebook Github Bot
parent 0bf520a821
commit b002df945b
6 changed files with 109 additions and 3 deletions

View File

@@ -116,21 +116,47 @@ public class UIManagerModule extends ReactContextBaseJavaModule
private final MemoryTrimCallback mMemoryTrimCallback = new MemoryTrimCallback();
private final List<UIManagerModuleListener> mListeners = new ArrayList<>();
private @Nullable Map<String, WritableMap> mViewManagerConstantsCache;
volatile private int mViewManagerConstantsCacheSize;
private volatile int mViewManagerConstantsCacheSize;
private int mBatchId = 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 EventDispatcher(reactContext);
mModuleConstants = createConstants(viewManagerResolver);
mCustomDirectEvents = UIManagerModuleConstants.getDirectEventTypeConstants();
mUIImplementation =
new UIImplementation(
uiImplementationProvider.createUIImplementation(
reactContext,
viewManagerResolver,
mEventDispatcher,
@@ -139,9 +165,11 @@ 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);
@@ -149,7 +177,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
mCustomDirectEvents = MapBuilder.newHashMap();
mModuleConstants = createConstants(viewManagersList, null, mCustomDirectEvents);
mUIImplementation =
new UIImplementation(
uiImplementationProvider.createUIImplementation(
reactContext,
viewManagersList,
mEventDispatcher,
@@ -157,6 +185,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
reactContext.addLifecycleEventListener(this);
}
/**
* This method gives an access to the {@link UIImplementation} object that can be used to execute
* operations on the view hierarchy.