Skip to content

Commit 57fc114

Browse files
Nick LefeverSaadnajmi
authored andcommitted
[fabric] Fix events being dispatched to wrong react component for Paper components
Summary: The tag value is stored in the `reactTag` property on macOS. The adapter used by the RCTLegacyViewManagerInteropComponentView was being provided the `tag` property value which set all interceptors to tag -1 leading to incorrect event dispatching on the JS side. Test Plan: - Open the settings pane in Zeratul and select the appearance tab. - Toggle the theme PopUpButton With the fix, the theme changes while before the zoom would change. https://pxl.cl/3vZRd Reviewers: shawndempsey, #rn-desktop Reviewed By: shawndempsey Differential Revision: https://phabricator.intern.facebook.com/D49897662
1 parent 2428d74 commit 57fc114

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#import <react/utils/ManagedObjectWrapper.h>
1717
#import "RCTLegacyViewManagerInteropCoordinatorAdapter.h"
1818

19+
#if TARGET_OS_OSX // [macOS
20+
#import <React/RCTView.h>
21+
#endif // macOS]
22+
1923
using namespace facebook::react;
2024

2125
static NSString *const kRCTLegacyInteropChildComponentKey = @"childComponentView";
@@ -210,8 +214,14 @@ - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask
210214
};
211215

212216
if (!_adapter) {
217+
#if !TARGET_OS_OSX // [macOS]
213218
_adapter = [[RCTLegacyViewManagerInteropCoordinatorAdapter alloc] initWithCoordinator:[self _coordinator]
214219
reactTag:self.tag];
220+
#else // [macOS
221+
_adapter = [[RCTLegacyViewManagerInteropCoordinatorAdapter alloc] initWithCoordinator:[self _coordinator]
222+
reactTag:self.reactTag.integerValue];
223+
#endif // macOS]
224+
215225
_adapter.eventInterceptor = ^(std::string eventName, folly::dynamic event) {
216226
if (weakSelf) {
217227
__typeof(self) strongSelf = weakSelf;

0 commit comments

Comments
 (0)