Reduce exposure of UIManagerModule in the NativeAnimatedNodesManager class

Summary:
This diff reduces exposure of UIManagerModule in the NativeAnimatedNodesManager class, this is necessary to enable NativeDriverAnimations in Venice

changelog: [Internal][Android] Internal change to enable native driver animations in RN bridgless mode

Reviewed By: ejanzer

Differential Revision: D21317629

fbshipit-source-id: 81cd4ade296de4757acefe566e1466154d6b4e4b
This commit is contained in:
David Vacca
2020-05-01 00:19:58 -07:00
committed by Facebook GitHub Bot
parent f0dfd35108
commit f82a6d78c9
2 changed files with 9 additions and 4 deletions
@@ -15,12 +15,14 @@ import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.IllegalViewOperationException;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.events.Event;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.uimanager.events.EventDispatcherListener;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -53,14 +55,16 @@ import java.util.Queue;
// there will be only one driver per mapping so all code code should be optimized around that.
private final Map<String, List<EventAnimationDriver>> mEventDrivers = new HashMap<>();
private final UIManagerModule.CustomEventNamesResolver mCustomEventNamesResolver;
private final UIManagerModule mUIManagerModule;
private final UIManager mUIManager;
private int mAnimatedGraphBFSColor = 0;
// Used to avoid allocating a new array on every frame in `runUpdates` and `onEventDispatch`.
private final List<AnimatedNode> mRunUpdateNodeList = new LinkedList<>();
public NativeAnimatedNodesManager(UIManagerModule uiManager) {
mUIManagerModule = uiManager;
uiManager.getEventDispatcher().addListener(this);
mUIManager = uiManager;
mUIManager.<EventDispatcher>getEventDispatcher().addListener(this);
// TODO T64216139 Remove dependency of UIManagerModule when the Constants are not in Native
// anymore
mCustomEventNamesResolver = uiManager.getDirectEventNamesResolver();
}
@@ -85,7 +89,7 @@ import java.util.Queue;
} else if ("value".equals(type)) {
node = new ValueAnimatedNode(config);
} else if ("props".equals(type)) {
node = new PropsAnimatedNode(config, this, mUIManagerModule);
node = new PropsAnimatedNode(config, this, mUIManager);
} else if ("interpolation".equals(type)) {
node = new InterpolationAnimatedNode(config);
} else if ("addition".equals(type)) {
@@ -807,6 +807,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule
mUIImplementation.setViewHierarchyUpdateDebugListener(listener);
}
@Override
public EventDispatcher getEventDispatcher() {
return mEventDispatcher;
}