Skip to content

Commit 08dc34e

Browse files
Saadnajmiclaude
andcommitted
fix(macOS): update Paper hit testing callers for transform-aware coordinate conversion
Update RCTUIViewHitTestWithEvent callers in Paper architecture to use the new fromView parameter, enabling transform-aware hit testing in old architecture as well. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 48c9d32 commit 08dc34e

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

packages/react-native/React/Modules/RCTUIManager.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ - (void)synchronouslyUpdateViewOnUIThread:(NSNumber *)reactTag viewName:(NSStrin
11861186
{
11871187
[self addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, RCTPlatformView *> *viewRegistry) { // [macOS]
11881188
RCTPlatformView *view = viewRegistry[reactTag]; // [macOS]
1189-
RCTPlatformView *target = RCTUIViewHitTestWithEvent(view, point, nil); // [macOS]
1189+
RCTPlatformView *target = RCTUIViewHitTestWithEvent(view, point, view, nil); // [macOS]
11901190
CGRect frame = [target convertRect:target.bounds toView:view];
11911191

11921192
while (target.reactTag == nil && target.superview != nil) {

packages/react-native/React/Views/RCTView.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ - (RCTPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event // [macOS
257257
// of the hit view will return YES from -pointInside:withEvent:). See:
258258
// - https://developer.apple.com/library/ios/qa/qa2013/qa1812.html
259259
for (RCTUIView *subview in [sortedSubviews reverseObjectEnumerator]) { // [macOS]
260-
CGPoint pointForHitTest = [subview convertPoint:point fromView:self];
261-
hitSubview = RCTUIViewHitTestWithEvent(subview, pointForHitTest, event); // macOS]
260+
hitSubview = RCTUIViewHitTestWithEvent(subview, point, self, event); // [macOS]
262261
if (hitSubview != nil) {
263262
break;
264263
}

packages/react-native/React/Views/UIView+React.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ - (BOOL)isReactRootView
6868

6969
- (NSNumber *)reactTagAtPoint:(CGPoint)point
7070
{
71-
RCTPlatformView *view = RCTUIViewHitTestWithEvent(self, point, nil); // [macOS]
71+
RCTPlatformView *view = RCTUIViewHitTestWithEvent(self, point, self, nil); // [macOS]
7272
while (view && !view.reactTag) {
7373
view = view.superview;
7474
}

0 commit comments

Comments
 (0)