Skip to content

Commit a9c8649

Browse files
committed
refactor(fabric): Make the diff in [RCTViewComponentView betterHitTest:withEvent:] more transparent
1 parent 2d4d460 commit a9c8649

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -669,16 +669,17 @@ - (RCTUIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS
669669
}
670670

671671
for (RCTUIView *subview in [self.subviews reverseObjectEnumerator]) { // [macOS]
672-
// Native macOS views require the point to be in the super view coordinate space for hit testing. [macOS]
672+
#if !TARGET_OS_OSX // [macOS]
673+
RCTUIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event]; // [macOS]
674+
#else // [macOS
675+
// Native macOS views require the point to be in the super view coordinate space for hit testing.
673676
CGPoint hitTestPoint = point;
674-
#if TARGET_OS_OSX // [macOS
675677
// Fabric components use the target view coordinate space for hit testing
676678
if ([subview isKindOfClass:[RCTViewComponentView class]]) {
677679
hitTestPoint = [subview convertPoint:point fromView:self];
678680
}
679-
#endif // macOS]
680-
681681
RCTUIView *hitView = [subview hitTest:hitTestPoint withEvent:event]; // [macOS]
682+
#endif // macOS]
682683
if (hitView) {
683684
return hitView;
684685
}

0 commit comments

Comments
 (0)