@@ -128,8 +128,9 @@ - (void)_recordNewTouches:(NSSet *)touches
128128#else // [macOS
129129 // -[NSView hitTest:] takes coordinates in a view's superview coordinate system.
130130 // The assumption here is that a RCTUIView/RCTSurfaceView will always have a superview.
131- CGPoint touchLocation = [self .view.superview convertPoint: touch.locationInWindow fromView: nil ];
132- NSView *targetView = [self .view hitTest: touchLocation];
131+ NSView *superview = [[self view ] superview ];
132+ const CGPoint touchLocationInSuperview = [superview convertPoint: touch.locationInWindow fromView: nil ];
133+ NSView *targetView = [self .view hitTest: touchLocationInSuperview];
133134 // Don't record clicks on scrollbars.
134135 if ([targetView isKindOfClass: [NSScroller class ]]) {
135136 continue ;
@@ -148,8 +149,7 @@ - (void)_recordNewTouches:(NSSet *)touches
148149 } else {
149150 _shouldSendMouseUpOnSystemBehalf = NO ;
150151 }
151- touchLocation = [targetView convertPoint: touchLocation fromView: self .view.superview];
152-
152+
153153 while (targetView) {
154154 BOOL isUserInteractionEnabled = NO ;
155155 if ([((RCTUIView*)targetView) respondsToSelector: @selector (isUserInteractionEnabled )]) { // [macOS]
@@ -161,7 +161,8 @@ - (void)_recordNewTouches:(NSSet *)touches
161161 targetView = targetView.superview ;
162162 }
163163
164- NSNumber *reactTag = [targetView reactTagAtPoint: touchLocation];
164+ const CGPoint touchLocationInSelf = [targetView convertPoint: touchLocationInSuperview fromView: self .view.superview];
165+ NSNumber *reactTag = [targetView reactTagAtPoint: touchLocationInSelf];
165166 BOOL isUserInteractionEnabled = NO ;
166167 if ([((RCTUIView*)targetView) respondsToSelector: @selector (isUserInteractionEnabled )]) { // [macOS]
167168 isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled ; // [macOS]
0 commit comments