Skip to content

[Web] Pan's onEnd reports the drag's velocity after the pointer has stopped #4636

Closed

Description

@YevheniiKotyrlo

Description

On web, a Pan released after the pointer has stopped still reports the velocity of its last move in onEnd. The same drag, 160 px in 48 ms, reports velocityX 3304 when released at its last move and 3333 when released 500 ms later, so a withDecay started from it flings a pointer that had come to rest. On Android the late release reports 0: the handler feeds the up event to VelocityTracker before end() (PanGestureHandler.kt#L205-L213), and the tracker clears its samples when that event comes more than 40 ms after the last move (VelocityTracker.cpp#309).

The web onPointerUp ends the gesture without updating the velocity (PanGestureHandler.ts#L261-L283), so the event carries the value the last onPointerMove computed.

Steps to reproduce

  1. Render App.tsx from the gist on web (npx expo start --web).

  2. Drag the square quickly, stop, keep the mouse still for a second, then release: the line under the square shows the velocity of the drag instead of 0.

  3. For exact timing, run node reproduce.mjs http://localhost:8081 from the gist. It sends the same drag twice through the DevTools protocol with event timestamps, releasing once at the last move and once 500 ms later, and prints:

    released at the last move:       release 1: velocityX 3304
    released 500 ms after last move: release 2: velocityX 3333
    

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

https://gist.github.com/YevheniiKotyrlo/b2fb0c93d8fa8434464c69901817333d

Gesture Handler version

2.32.0; main at a83496b has the same onPointerUp

React Native version

0.86.3, with react-native-web 0.21.2

Platforms

Web

JavaScript runtime

V8

Workflow

Using Expo Prebuild or an Expo development build

Build type

Debug mode

Device

Real device

Device model

Chromium 156 on Windows 11

Acknowledgements

Yes

Activity

  1. added 2 commits that reference this issue on Oct 28, 2026
    613be1c
    b19e233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions