refactor(fabric): Make the diff in `[RCTViewComponentView betterHitTest:withEvent:]` more transparent

This commit is contained in:
Saad Najmi 2024-11-28 15:53:57 -08:00
Родитель 2d4d4608cc
Коммит a9c86497f8
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -669,16 +669,17 @@ const CGFloat BACKGROUND_COLOR_ZPOSITION = -1024.0f;
}
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;
}