Skip to content

Commit

Permalink
Reduce exposure of UIManagerModule in the NativeAnimatedNodesManager …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
mdvacca authored and facebook-github-bot committed May 1, 2020
1 parent f0dfd35 commit f82a6d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
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;
Expand Down Expand Up @@ -53,14 +55,16 @@
// 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();
}

Expand All @@ -85,7 +89,7 @@ public void createAnimatedNode(int tag, ReadableMap config) {
} 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ public void setViewHierarchyUpdateDebugListener(
mUIImplementation.setViewHierarchyUpdateDebugListener(listener);
}

@Override
public EventDispatcher getEventDispatcher() {
return mEventDispatcher;
}
Expand Down

0 comments on commit f82a6d7

Please sign in to comment.