mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Native view manager event types exposed to JS via view config
Differential Revision: D5814210 fbshipit-source-id: 41291f0d6b39af77f66173f6a699d88f9f4ccc74
This commit is contained in:
1 parent
e9780bdc0f
commit
75c94a8907
9 files changed
+121
-624
No files matched your search
+12
-12
@@ -25,14 +25,10 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
*/
|
||||
/* package */ class UIManagerModuleConstantsHelper {
|
||||
|
||||
private static final String CUSTOM_BUBBLING_EVENT_TYPES_KEY = "customBubblingEventTypes";
|
||||
private static final String CUSTOM_DIRECT_EVENT_TYPES_KEY = "customDirectEventTypes";
|
||||
|
||||
/**
|
||||
* Generates map of constants that is then exposed by {@link UIManagerModule}. The constants map
|
||||
* contains the following predefined fields for 'customBubblingEventTypes' and
|
||||
* 'customDirectEventTypes'. Provided list of {@param viewManagers} is then used to populate
|
||||
* content of those predefined fields using
|
||||
* Generates map of constants that is then exposed by {@link UIManagerModule}.
|
||||
* Provided list of {@param viewManagers} is then used to populate content of
|
||||
* those predefined fields using
|
||||
* {@link ViewManager#getExportedCustomBubblingEventTypeConstants} and
|
||||
* {@link ViewManager#getExportedCustomDirectEventTypeConstants} respectively. Each view manager
|
||||
* is in addition allowed to expose viewmanager-specific constants that are placed under the key
|
||||
@@ -53,15 +49,21 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
.arg("ViewManager", viewManager.getName())
|
||||
.flush();
|
||||
try {
|
||||
Map viewManagerConstants = MapBuilder.newHashMap();
|
||||
Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
|
||||
if (viewManagerBubblingEvents != null) {
|
||||
recursiveMerge(bubblingEventTypesConstants, viewManagerBubblingEvents);
|
||||
recursiveMerge(viewManagerBubblingEvents, bubblingEventTypesConstants);
|
||||
viewManagerConstants.put("bubblingEventTypes", viewManagerBubblingEvents);
|
||||
} else {
|
||||
viewManagerConstants.put("bubblingEventTypes", bubblingEventTypesConstants);
|
||||
}
|
||||
Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
|
||||
if (viewManagerDirectEvents != null) {
|
||||
recursiveMerge(directEventTypesConstants, viewManagerDirectEvents);
|
||||
recursiveMerge(viewManagerDirectEvents, directEventTypesConstants);
|
||||
viewManagerConstants.put("directEventTypes", viewManagerDirectEvents);
|
||||
} else {
|
||||
viewManagerConstants.put("directEventTypes", directEventTypesConstants);
|
||||
}
|
||||
Map viewManagerConstants = MapBuilder.newHashMap();
|
||||
Map customViewConstants = viewManager.getExportedViewConstants();
|
||||
if (customViewConstants != null) {
|
||||
viewManagerConstants.put("Constants", customViewConstants);
|
||||
@@ -82,8 +84,6 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
}
|
||||
}
|
||||
|
||||
constants.put(CUSTOM_BUBBLING_EVENT_TYPES_KEY, bubblingEventTypesConstants);
|
||||
constants.put(CUSTOM_DIRECT_EVENT_TYPES_KEY, directEventTypesConstants);
|
||||
constants.put("AndroidLazyViewManagersEnabled", lazyViewManagersEnabled);
|
||||
|
||||
return constants;
|
||||
|
||||
Reference in new issue
Block a user