mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Untangle NativeAnimatedNodesManager from UIManager internals.
Reviewed By: AaaChiuuu Differential Revision: D5861523 fbshipit-source-id: 39eb79b91d4d5e2295d03369f1be585ae7836c75
This commit is contained in:
1 parent
5180995666
commit
4fc9e20fce
4 files changed
+67
-19
No files matched your search
@@ -70,6 +70,17 @@ import javax.annotation.Nullable;
|
||||
public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter {
|
||||
|
||||
|
||||
/**
|
||||
* Resolves a name coming from native side to a name of the event that is exposed to JS.
|
||||
*/
|
||||
public interface CustomEventNamesResolver {
|
||||
/**
|
||||
* Returns custom event name by the provided event name.
|
||||
*/
|
||||
@Nullable String resolveCustomEventName(String eventName);
|
||||
}
|
||||
|
||||
protected static final String NAME = "UIManager";
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
@@ -164,6 +175,27 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves Direct Event name exposed to JS from the one known to the Native side.
|
||||
*/
|
||||
public CustomEventNamesResolver getDirectEventNamesResolver() {
|
||||
return new CustomEventNamesResolver() {
|
||||
@Override
|
||||
public @Nullable String resolveCustomEventName(String eventName) {
|
||||
Map<String, Map> directEventTypes =
|
||||
(Map<String, Map>) getConstants().get(
|
||||
UIManagerModuleConstantsHelper.CUSTOM_DIRECT_EVENT_TYPES_KEY);
|
||||
if (directEventTypes != null) {
|
||||
Map<String, String> customEventType = (Map<String, String>) directEventTypes.get(eventName);
|
||||
if (customEventType != null) {
|
||||
return customEventType.get("registrationName");
|
||||
}
|
||||
}
|
||||
return eventName;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Long> getPerformanceCounters() {
|
||||
return mUIImplementation.getProfiledBatchPerfCounters();
|
||||
|
||||
Reference in new issue
Block a user