pass EventDispatcher to UIImplementation constructor

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

@public

Reviewed By: lexs

Differential Revision: D3899774
This commit is contained in:
Felix Oghina 2016-10-04 12:21:03 -07:00 committed by Ahmed El-Helw
parent e4129fe1b4
commit ab5de9b9ae
2 changed files with 16 additions and 12 deletions

View File

@ -21,8 +21,8 @@ import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.modules.i18nmanager.I18nUtil;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.ReactShadowNode;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.UIImplementation;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.uimanager.ViewManagerRegistry;
@ -38,7 +38,8 @@ public class FlatUIImplementation extends UIImplementation {
public static FlatUIImplementation createInstance(
ReactApplicationContext reactContext,
List<ViewManager> viewManagers) {
List<ViewManager> viewManagers,
EventDispatcher eventDispatcher) {
ReactImageManager reactImageManager = findReactImageManager(viewManagers);
if (reactImageManager != null) {
@ -73,7 +74,8 @@ public class FlatUIImplementation extends UIImplementation {
reactContext,
reactImageManager,
viewManagerRegistry,
operationsQueue
operationsQueue,
eventDispatcher
);
}
@ -90,8 +92,9 @@ public class FlatUIImplementation extends UIImplementation {
ReactApplicationContext reactContext,
@Nullable ReactImageManager reactImageManager,
ViewManagerRegistry viewManagers,
FlatUIViewOperationQueue operationsQueue) {
super(reactContext, viewManagers, operationsQueue);
FlatUIViewOperationQueue operationsQueue,
EventDispatcher eventDispatcher) {
super(reactContext, viewManagers, operationsQueue, eventDispatcher);
mReactContext = reactContext;
mStateBuilder = new StateBuilder(operationsQueue);
mReactImageManager = reactImageManager;
@ -502,17 +505,16 @@ public class FlatUIImplementation extends UIImplementation {
}
@Override
protected void updateViewHierarchy(EventDispatcher eventDispatcher) {
super.updateViewHierarchy(eventDispatcher);
mStateBuilder.afterUpdateViewHierarchy(eventDispatcher);
protected void updateViewHierarchy() {
super.updateViewHierarchy();
mStateBuilder.afterUpdateViewHierarchy(mEventDispatcher);
}
@Override
protected void applyUpdatesRecursive(
ReactShadowNode cssNode,
float absoluteX,
float absoluteY,
EventDispatcher eventDispatcher) {
float absoluteY) {
mStateBuilder.applyUpdates((FlatRootShadowNode) cssNode);
}

View File

@ -14,6 +14,7 @@ import java.util.List;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.UIImplementationProvider;
import com.facebook.react.uimanager.ViewManager;
import com.facebook.react.uimanager.events.EventDispatcher;
/**
* UIImplementationProvider that creates instances of {@link FlatUIImplementation}.
@ -22,7 +23,8 @@ public final class FlatUIImplementationProvider extends UIImplementationProvider
@Override
public FlatUIImplementation createUIImplementation(
ReactApplicationContext reactContext,
List<ViewManager> viewManagers) {
return FlatUIImplementation.createInstance(reactContext, viewManagers);
List<ViewManager> viewManagers,
EventDispatcher eventDispatcher) {
return FlatUIImplementation.createInstance(reactContext, viewManagers, eventDispatcher);
}
}