Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[fabric] Fix events being dispatched to wrong react component for Pap…
…er 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
  • Loading branch information
Nick Lefever authored and Saadnajmi committed Nov 15, 2024
commit 5aacc3eb95f00829c5929d03fcce3099f23293c5
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#import <react/utils/ManagedObjectWrapper.h>
#import "RCTLegacyViewManagerInteropCoordinatorAdapter.h"

#if TARGET_OS_OSX // [macOS
#import <React/RCTView.h>
#endif // macOS]

using namespace facebook::react;

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

if (!_adapter) {
#if !TARGET_OS_OSX // [macOS]
_adapter = [[RCTLegacyViewManagerInteropCoordinatorAdapter alloc] initWithCoordinator:[self _coordinator]
reactTag:self.tag];
#else // [macOS
_adapter = [[RCTLegacyViewManagerInteropCoordinatorAdapter alloc] initWithCoordinator:[self _coordinator]
reactTag:self.reactTag.integerValue];
#endif // macOS]

_adapter.eventInterceptor = ^(std::string eventName, folly::dynamic event) {
if (weakSelf) {
__typeof(self) strongSelf = weakSelf;
Expand Down
Loading