Skip to content

Commit

Permalink
Fabric Interop - Also normalize direct events (#38352)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jul 17, 2023
1 parent e21c25e commit 995bb3e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ private static void validateDirectEventNames(

Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
if (viewManagerBubblingEvents != null) {

if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
// For Fabric, events needs to be fired with a "top" prefix.
// For the sake of Fabric Interop, here we normalize events adding "top" in their
Expand All @@ -162,6 +161,12 @@ private static void validateDirectEventNames(
Map viewManagerDirectEvents = viewManager.getExportedCustomDirectEventTypeConstants();
validateDirectEventNames(viewManager.getName(), viewManagerDirectEvents);
if (viewManagerDirectEvents != null) {
if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
// For Fabric, events needs to be fired with a "top" prefix.
// For the sake of Fabric Interop, here we normalize events adding "top" in their
// name if the user hasn't provided it.
normalizeEventTypes(viewManagerDirectEvents);
}
recursiveMerge(cumulativeDirectEventTypes, viewManagerDirectEvents);
recursiveMerge(viewManagerDirectEvents, defaultDirectEvents);
viewManagerConstants.put(DIRECT_EVENTS_KEY, viewManagerDirectEvents);
Expand Down

0 comments on commit 995bb3e

Please sign in to comment.