ShadowNodeHierarchyManager should be supplied externally to UIManagerModule

Summary: public UIManagerModule should not be creating UIImplementation. Instead, UIImplementation instance should be supplied to it to allow plugging in different implementations. No functional changes.

Reviewed By: astreet

Differential Revision: D2464632

fb-gh-sync-id: e7372977c93ceb7ef5e8658e5ee7e8e87f52d851
This commit is contained in:
Denis Koroskin
2015-11-28 11:00:43 -08:00
committed by facebook-github-bot-5
parent 599a130c9a
commit fd0d987768
3 changed files with 25 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
/**
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
@@ -78,17 +78,27 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
private int mNextRootViewTag = 1;
private int mBatchId = 0;
public UIManagerModule(ReactApplicationContext reactContext, List<ViewManager> viewManagerList) {
/**
* This contructor is temporarily here to workaround Sandcastle error.
*/
public UIManagerModule(
ReactApplicationContext reactContext,
List<ViewManager> viewManagerList) {
this(reactContext, viewManagerList, new UIImplementation(reactContext, viewManagerList));
}
public UIManagerModule(
ReactApplicationContext reactContext,
List<ViewManager> viewManagerList,
UIImplementation uiImplementation) {
super(reactContext);
mEventDispatcher = new EventDispatcher(reactContext);
DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
DisplayMetricsHolder.setDisplayMetrics(displayMetrics);
mModuleConstants = createConstants(displayMetrics, viewManagerList);
reactContext.addLifecycleEventListener(this);
mUIImplementation = uiImplementation;
mUIImplementation = new UIImplementation(
reactContext,
new ViewManagerRegistry(viewManagerList));
reactContext.addLifecycleEventListener(this);
}
@Override