Skip to content

Commit

Permalink
refactor(fabric): Make the diff in `[RCTViewComponentView betterHitTe…
Browse files Browse the repository at this point in the history
…st:withEvent:]` more transparent
  • Loading branch information
Saadnajmi committed Nov 28, 2024
1 parent 10c973a commit 953c929
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,16 +660,17 @@ - (RCTUIView *)betterHitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS
}

for (RCTUIView *subview in [self.subviews reverseObjectEnumerator]) { // [macOS]
// Native macOS views require the point to be in the super view coordinate space for hit testing. [macOS]
#if !TARGET_OS_OSX // [macOS]
RCTUIView *hitView = [subview hitTest:[subview convertPoint:point fromView:self] withEvent:event]; // [macOS]
#else // [macOS
// Native macOS views require the point to be in the super view coordinate space for hit testing.
CGPoint hitTestPoint = point;
#if TARGET_OS_OSX // [macOS
// Fabric components use the target view coordinate space for hit testing
if ([subview isKindOfClass:[RCTViewComponentView class]]) {
hitTestPoint = [subview convertPoint:point fromView:self];
}
#endif // macOS]

RCTUIView *hitView = [subview hitTest:hitTestPoint withEvent:event]; // [macOS]
#endif // macOS]
if (hitView) {
return hitView;
}
Expand Down

0 comments on commit 953c929

Please sign in to comment.