Skip to content

Commit 995bb3e

Browse files
cortinicofacebook-github-bot
authored andcommitted
Fabric Interop - Also normalize direct events (#38352)
Summary: Pull Request resolved: #38352 This change is making sure we normalize both bubbling and direct events for the sake of Fabric Interop. This is currently required as some libraries have reported incompatiblities with Fabric Interop (see react-native-maps/react-native-maps#4383) Also this is has been reported by the WG here: reactwg/react-native-new-architecture#135 (comment) Changelog: [Android] [Fixed] - Fabric Interop - Fix support for direct events on Paper components Reviewed By: rshest Differential Revision: D47472050 fbshipit-source-id: f0ae95cb782e340281928819a702273fb14e9b16
1 parent e21c25e commit 995bb3e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ private static void validateDirectEventNames(
145145

146146
Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
147147
if (viewManagerBubblingEvents != null) {
148-
149148
if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
150149
// For Fabric, events needs to be fired with a "top" prefix.
151150
// For the sake of Fabric Interop, here we normalize events adding "top" in their
@@ -162,6 +161,12 @@ private static void validateDirectEventNames(
162161
Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
163162
validateDirectEventNames(viewManager.getName(), viewManagerDirectEvents);
164163
if (viewManagerDirectEvents != null) {
164+
if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
165+
// For Fabric, events needs to be fired with a "top" prefix.
166+
// For the sake of Fabric Interop, here we normalize events adding "top" in their
167+
// name if the user hasn't provided it.
168+
normalizeEventTypes(viewManagerDirectEvents);
169+
}
165170
recursiveMerge(cumulativeDirectEventTypes, viewManagerDirectEvents);
166171
recursiveMerge(viewManagerDirectEvents, defaultDirectEvents);
167172
viewManagerConstants.put(DIRECT_EVENTS_KEY, viewManagerDirectEvents);

0 commit comments

Comments
 (0)