Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Crawl the NSView hierarchy to find a react-managed view
This mirrors the behavior of upstream `react-native` for ios.
  • Loading branch information
russellmcc committed Apr 14, 2019
commit 1872ce83c3294909013ee05a46a048cfba3ce6b7
15 changes: 6 additions & 9 deletions React/Base/RCTTouchHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,14 @@ - (void)_recordNewTouches:(NSSet<NSEvent *> *)touches
touchLocation = [touch.window.contentView convertPoint:touchLocation toView:self.view.superview];
}

// TODO: get rid of explicit comparison
//
// Check if item is becoming first responder to delete touch
NSView *targetView = [self.view hitTest:touchLocation];

if (![targetView.className isEqualToString:@"RCTView"] &&
![targetView.className isEqualToString:@"RCTTextView"] &&
![targetView.className isEqualToString:@"RCTImageView"] &&
![targetView.className isEqualToString:@"ARTSurfaceView"]) {
self.state = NSGestureRecognizerStateEnded;
return;
// Find closest React-managed touchable view
while (targetView) {
if (targetView.reactTag) {
break;
}
targetView = targetView.superview;
}

NSNumber *reactTag = [self.view reactTagAtPoint:CGPointMake(touchLocation.x, touchLocation.y)];
Expand Down