mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-06 22:38:37 +08:00
Untangle NativeAnimatedNodesManager from UIManager internals.
Reviewed By: AaaChiuuu Differential Revision: D5861523 fbshipit-source-id: 39eb79b91d4d5e2295d03369f1be585ae7836c75
This commit is contained in:
committed by
Facebook Github Bot
parent
5180995666
commit
4fc9e20fce
@@ -22,6 +22,8 @@ import com.facebook.react.uimanager.events.Event;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -108,6 +110,27 @@ public class NativeAnimatedNodeTraversalTest {
|
||||
return MapBuilder.of("customDirectEventTypes", MapBuilder.newHashMap());
|
||||
}
|
||||
});
|
||||
PowerMockito
|
||||
.when(mUIManagerMock.getDirectEventNamesResolver())
|
||||
.thenAnswer(new Answer<UIManagerModule.CustomEventNamesResolver>() {
|
||||
@Override
|
||||
public UIManagerModule.CustomEventNamesResolver answer(InvocationOnMock invocation) throws Throwable {
|
||||
return new UIManagerModule.CustomEventNamesResolver() {
|
||||
@Override
|
||||
public String resolveCustomEventName(String eventName) {
|
||||
Map<String, Map> directEventTypes =
|
||||
(Map<String, Map>) mUIManagerMock.getConstants().get("customDirectEventTypes");
|
||||
if (directEventTypes != null) {
|
||||
Map<String, String> customEventType = (Map<String, String>) directEventTypes.get(eventName);
|
||||
if (customEventType != null) {
|
||||
return customEventType.get("registrationName");
|
||||
}
|
||||
}
|
||||
return eventName;
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
mNativeAnimatedNodesManager = new NativeAnimatedNodesManager(mUIManagerMock);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user