@@ -128,8 +128,9 @@ - (void)_recordNewTouches:(NSSet *)touches
128
128
#else // [macOS
129
129
// -[NSView hitTest:] takes coordinates in a view's superview coordinate system.
130
130
// 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];
133
134
// Don't record clicks on scrollbars.
134
135
if ([targetView isKindOfClass: [NSScroller class ]]) {
135
136
continue ;
@@ -148,8 +149,7 @@ - (void)_recordNewTouches:(NSSet *)touches
148
149
} else {
149
150
_shouldSendMouseUpOnSystemBehalf = NO ;
150
151
}
151
- touchLocation = [targetView convertPoint: touchLocation fromView: self .view.superview];
152
-
152
+
153
153
while (targetView) {
154
154
BOOL isUserInteractionEnabled = NO ;
155
155
if ([((RCTUIView*)targetView) respondsToSelector: @selector (isUserInteractionEnabled )]) { // [macOS]
@@ -161,7 +161,8 @@ - (void)_recordNewTouches:(NSSet *)touches
161
161
targetView = targetView.superview ;
162
162
}
163
163
164
- NSNumber *reactTag = [targetView reactTagAtPoint: touchLocation];
164
+ const CGPoint touchLocationInSelf = [targetView convertPoint: touchLocationInSuperview fromView: self .view.superview];
165
+ NSNumber *reactTag = [targetView reactTagAtPoint: touchLocationInSelf];
165
166
BOOL isUserInteractionEnabled = NO ;
166
167
if ([((RCTUIView*)targetView) respondsToSelector: @selector (isUserInteractionEnabled )]) { // [macOS]
167
168
isUserInteractionEnabled = ((RCTUIView*)targetView).isUserInteractionEnabled ; // [macOS]
0 commit comments