Skip to content

[Android] Fix wrong reported number of pointers#4218

Open
j-piasecki wants to merge 1 commit into
mainfrom
@jpiasecki/fix-android-number-of-pointers
Open

[Android] Fix wrong reported number of pointers#4218
j-piasecki wants to merge 1 commit into
mainfrom
@jpiasecki/fix-android-number-of-pointers

Conversation

@j-piasecki
Copy link
Copy Markdown
Member

Description

Fixes #3435

Android includes the pointer being lifted in the ACTION_POINTER_UP event, so the event where the pointer is lifted is sent with numberOfPointers = 2. This PR changes that so the numberOfPointers is reported as n - 1 for ACTION_POINTER_UP events.

Note: The same applies to ACTION_UP and ACTION_CANCEL but I didn't include them to keep the behavior the same as on iOS.

Test plan

Reproducer from #3435

Copilot AI review requested due to automatic review settings June 1, 2026 08:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect numberOfPointers reported to JS on Android for ACTION_POINTER_UP events (Android includes the lifted pointer in MotionEvent.pointerCount for that event), aligning the reported pointer count with the number of pointers remaining on screen and preventing pinch “jump” scenarios like #3435.

Changes:

  • Adjust numberOfPointers calculation on Android to report pointerCount - 1 for ACTION_POINTER_UP.
  • Preserve existing behavior for ACTION_UP / ACTION_CANCEL to stay consistent with iOS behavior as noted in the PR description.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android pointer number remains 2 when lifting one finger during pinch gesture

3 participants