You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Web] Pan's onEnd reports the drag's velocity after the pointer has stopped #4636
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
Render App.tsx from the gist on web (npx expo start --web).
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.
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.
Activity
[Web] Report zero Pan velocity when the pointer rested before release (…
[iOS] Report zero Pan velocity when the pointer rested before release (…