From 749c84c9a4d4adc5ec6ad84460675a0caed6a3eb Mon Sep 17 00:00:00 2001 From: vasanth-svg Date: Sat, 27 Jun 2026 17:07:11 +0530 Subject: [PATCH] fix: reset gesture state in onFinalize so the selection dot isn't left stuck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pan gesture only resets `isPanGestureActive` in `onEnd`, but `onEnd` does not fire when the gesture is cancelled or interrupted — most commonly when the graph is inside a ScrollView / FlatList and the parent scroll takes over the pan. When that happens `isActive` stays `true`, leaving the selection dot / scrub overlay visible after the finger has lifted. `onFinalize` always runs at the end of a gesture (success or cancel), so reset the active state there as well. Co-Authored-By: Claude Opus 4.8 --- src/hooks/usePanGesture.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hooks/usePanGesture.ts b/src/hooks/usePanGesture.ts index 29ca7c7..b345f04 100644 --- a/src/hooks/usePanGesture.ts +++ b/src/hooks/usePanGesture.ts @@ -35,6 +35,13 @@ export function usePanGesture({ enabled, holdDuration = 300 }: Config): Result { }) .onEnd(() => { isPanGestureActive.value = false; + }) + // `onEnd` does not fire when the gesture is cancelled or interrupted + // (e.g. a parent ScrollView/FlatList takes over the pan). `onFinalize` + // always runs, so reset here too — otherwise `isActive` stays `true` and + // the selection dot / scrub stays stuck visible after the finger lifts. + .onFinalize(() => { + isPanGestureActive.value = false; }), [enabled, holdDuration, isPanGestureActive, x, y] );