pass EventDispatcher to UIImplementation constructor

Summary: This way `UIImplementation` can hold on to it and use it outside of calls from the `UIManagerModule`.

Reviewed By: lexs

Differential Revision: D3899774

fbshipit-source-id: 01e4956c4540bcdf30774a3f40a625e934714ee9
This commit is contained in:
Felix Oghina
2016-10-04 12:29:13 -07:00
committed by Facebook Github Bot
parent 5eb28dc4f0
commit f7cbd56d8e
15 changed files with 82 additions and 65 deletions
@@ -85,12 +85,13 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
public UIManagerModule(
ReactApplicationContext reactContext,
List<ViewManager> viewManagerList,
UIImplementation uiImplementation) {
UIImplementationProvider uiImplementationProvider) {
super(reactContext);
DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
mEventDispatcher = new EventDispatcher(reactContext);
mModuleConstants = createConstants(viewManagerList);
mUIImplementation = uiImplementation;
mUIImplementation = uiImplementationProvider
.createUIImplementation(reactContext, viewManagerList, mEventDispatcher);
reactContext.addLifecycleEventListener(this);
}
@@ -209,7 +210,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
public void updateNodeSize(int nodeViewTag, int newWidth, int newHeight) {
getReactApplicationContext().assertOnNativeModulesQueueThread();
mUIImplementation.updateNodeSize(nodeViewTag, newWidth, newHeight, mEventDispatcher);
mUIImplementation.updateNodeSize(nodeViewTag, newWidth, newHeight);
}
@ReactMethod
@@ -496,7 +497,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
.arg("BatchId", batchId)
.flush();
try {
mUIImplementation.dispatchViewUpdates(mEventDispatcher, batchId);
mUIImplementation.dispatchViewUpdates(batchId);
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}