fix(Android): apply numberOfPointers config to the pointer requirement in LongPressGestureHandler#4253
Open
prashanFOMO wants to merge 1 commit into
Conversation
…t in LongPressGestureHandler updateConfig was assigning the numberOfPointers config value to the inherited GestureHandler.numberOfPointers property (the live pointer count reported in event payloads, overwritten on every motion event) instead of numberOfPointersRequired, which gates activation and stayed at its default of 1. As a result, on Android a LongPress gesture with numberOfPointers > 1 activated with a single pointer and could never activate with the configured pointer count (the second pointer trips currentPointers > numberOfPointersRequired and fails the gesture).
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Android LongPressGestureHandler configuration to map the KEY_NUMBER_OF_POINTERS value onto the handler’s “required pointers” property.
Changes:
- Route
KEY_NUMBER_OF_POINTERSconfig tonumberOfPointersRequiredinstead ofnumberOfPointers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #4252
On Android, the
numberOfPointersconfig of the LongPress gesture has been silently ignored since 2.26.0: a gesture configured withGesture.LongPress().numberOfPointers(3)activates after a single-pointer long press, and can never activate with the configured pointer count (the second pointer tripscurrentPointers > numberOfPointersRequiredand fails the handler). iOS is unaffected, since the prop maps toUILongPressGestureRecognizer.numberOfTouchesRequired.The cause is a one-line mix-up introduced by the factory refactor in 2.26.0. The factory's
updateConfigassigns the config value tohandler.numberOfPointers, which resolves to the inheritedGestureHandler.numberOfPointers— the live pointer-count used for event payloads, overwritten withevent.pointerCounton every motion event. The field that actually gates activation,numberOfPointersRequired, stays at its default of1and is never written from config. Before 2.26.0, the module factory calledhandler.setNumberOfPointers(...), which setnumberOfPointersRequiredcorrectly.This PR routes the config value to
numberOfPointersRequired, restoring the pre-2.26 behavior. The private-field access from the nestedFactorymatches the existingmaxDistassignment directly above.Test plan
Gesture.LongPress().numberOfPointers(3)as a global gesture, and verified on an Android device:numberOfPointersset) are unaffected