Skip to content

Commit 8982fd1

Browse files
committed
fix: prevent unwanted and impossible touches on simulator
1 parent 1ce1da2 commit 8982fd1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

plugin/platforms/ios/src/GestureHandler.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,15 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
329329

330330
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
331331
{
332-
333-
332+
#if TARGET_IPHONE_SIMULATOR
333+
// we get unwanted touch on simulator which messes everything
334+
UIView* view = gestureRecognizer.view;
335+
CGPoint location = [touch locationInView:gestureRecognizer.view];
336+
if (touch.phase == UITouchPhaseBegan && location.x == 0 && round(location.y) == view.window.bounds.size.height) {
337+
return NO;
338+
}
339+
#endif // TARGET_IPHONE_SIMULATOR
340+
334341
// If hitSlop is set we use it to determine if a given gesture recognizer should start processing
335342
// touch stream. This only works for negative values of hitSlop as this method won't be triggered
336343
// unless touch startes in the bounds of the attached view. To acheve similar effect with positive

0 commit comments

Comments
 (0)