diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index 0d6f570477c32c..1578b00fa31025 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -16,6 +16,10 @@ #import #import "RCTLegacyViewManagerInteropCoordinatorAdapter.h" +#if TARGET_OS_OSX // [macOS +#import +#endif // macOS] + using namespace facebook::react; static NSString *const kRCTLegacyInteropChildComponentKey = @"childComponentView"; @@ -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; diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index d3a5748b4ecc41..1f5dbd7f8f7e91 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -862,6 +862,11 @@ - (void)invalidateLayer return; } +#if TARGET_OS_OSX // [macOS + // clipsToBounds is stubbed out on macOS because it's not part of NSView + layer.masksToBounds = self.clipsToBounds; +#endif // macOS] + const auto borderMetrics = _props->resolveBorderMetrics(_layoutMetrics); // Stage 1. Shadow Path diff --git a/packages/react-native/React/Views/RCTView.m b/packages/react-native/React/Views/RCTView.m index deff71bc2c1bba..9fc3fbf413895d 100644 --- a/packages/react-native/React/Views/RCTView.m +++ b/packages/react-native/React/Views/RCTView.m @@ -256,9 +256,11 @@ - (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS #if !TARGET_OS_OSX // [macOS] pointForHitTest = [subview convertPoint:point fromView:self]; #else // [macOS - if ([subview isKindOfClass:[RCTView class]]) { + // Paper and Fabric components use the target view coordinate space for hit testing + if ([subview isKindOfClass:[RCTView class]] || [subview respondsToSelector:@selector(updateProps:oldProps:)]) { pointForHitTest = [subview convertPoint:point fromView:self]; } else { + // Native macOS views require the point to be in the super view coordinate space for hit testing. pointForHitTest = point; } #endif // macOS]