Skip to content

Commit 953c929

Browse files
committed
refactor(fabric): Make the diff in [RCTViewComponentView betterHitTest:withEvent:] more transparent
1 parent 10c973a commit 953c929

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,16 +660,17 @@ - (RCTUIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS
660660
}
661661

662662
for (RCTUIView *subview in [self.subviews reverseObjectEnumerator]) { // [macOS]
663-
// Native macOS views require the point to be in the super view coordinate space for hit testing. [macOS]
663+
#if !TARGET_OS_OSX // [macOS]
664+
RCTUIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event]; // [macOS]
665+
#else // [macOS
666+
// Native macOS views require the point to be in the super view coordinate space for hit testing.
664667
CGPoint hitTestPoint = point;
665-
#if TARGET_OS_OSX // [macOS
666668
// Fabric components use the target view coordinate space for hit testing
667669
if ([subview isKindOfClass:[RCTViewComponentView class]]) {
668670
hitTestPoint = [subview convertPoint:point fromView:self];
669671
}
670-
#endif // macOS]
671-
672672
RCTUIView *hitView = [subview hitTest:hitTestPoint withEvent:event]; // [macOS]
673+
#endif // macOS]
673674
if (hitView) {
674675
return hitView;
675676
}

0 commit comments

Comments
 (0)