Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the web implementations of Pinch and Rotation to remain active when one pointer is lifted (i.e., not cancel/end on ADDITIONAL_POINTER_UP), enabling “continuous” transform gestures across pointer changes.
Changes:
- Update
PinchGestureHandlerandRotationGestureHandlerto keep pointer tracking up to date before early-returning when fewer than 2 pointers are present. - Stop ending an active pinch on
onPointerRemove(non-last pointer up). - Adjust web gesture detectors (
ScaleGestureDetector,RotationGestureDetector) to avoid finishing the gesture when a non-last pointer is lifted.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/react-native-gesture-handler/src/web/handlers/RotationGestureHandler.ts | Track pointer movement earlier so positions remain current even when <2 pointers. |
| packages/react-native-gesture-handler/src/web/handlers/PinchGestureHandler.ts | Keep pinch ACTIVE across onPointerRemove and track earlier on move/out-of-bounds. |
| packages/react-native-gesture-handler/src/web/detectors/ScaleGestureDetector.ts | Change “stream complete” conditions to not treat ADDITIONAL_POINTER_UP as completion. |
| packages/react-native-gesture-handler/src/web/detectors/RotationGestureDetector.ts | Reset rotation detector state on key pointer lift instead of finishing (ending). |
Comments suppressed due to low confidence (1)
packages/react-native-gesture-handler/src/web/detectors/ScaleGestureDetector.ts:52
ScaleGestureDetector.onTouchEventno longer treatsEventTypes.ADDITIONAL_POINTER_UPasstreamComplete, so it continues executing the rest of the method on pointer-up. In the common 2-pointer pinch case this leads toconfigChangedbeing true withdiv = numOfPointers - 1, producingspan = 0and (becausewasInProgressis true) immediately callingonScaleBeginagain on the pointer-up event. That resetsprevTime/currentSpanin a way that can skew the first subsequenttimeDelta/velocity and makes the detector appear "in progress" while only 1 pointer remains. Consider restoringEventTypes.ADDITIONAL_POINTER_UPto thestreamCompletecondition (and keep the continuous behavior inPinchGestureHandlerby not ending on pointer-remove), or otherwise early-return after handlingADDITIONAL_POINTER_UPsoonScaleBegincannot be re-entered on pointer-up.
const numOfPointers = tracker.trackedPointersCount;
const streamComplete: boolean =
action === EventTypes.UP || action === EventTypes.CANCEL;
if (action === EventTypes.DOWN || streamComplete) {
if (this.inProgress) {
this.onScaleEnd(this);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
Return on pointer up addresses suppressed @copilot comment. |
Pinch and Rotation on webPinch and Rotation
j-piasecki
approved these changes
May 8, 2026
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
This PR changes
PinchandRotationon web so that they're not cancelled after releasing one pointer.Test plan
Tested on Transformations example.
Also tested on the following code: