Clear pending timers on unmount in StatefulPressable (#4413)
## Description The stateful Pressable engine keeps four pending timers - `longPressTimeoutRef`, `pressDelayTimeoutRef`, `hoverInTimeout` and `hoverOutTimeout` - but never clears them on unmount. If the component unmounts while one is pending, the scheduled callback still fires (`onPressIn` / `onLongPress` / `onHoverIn` / `onHoverOut`, plus a `setState`), acting on a torn-down component. This adds a cleanup effect that clears all four on unmount, matching the cleanup the Touchable-based engine already has. Follow-up to #4411, flagged by CodeRabbit. ## Test plan Existing v3 suite passes (`yarn test` in `packages/react-native-gesture-handler`). No behavior change while mounted — the effect only cancels timers that would otherwise fire after unmount.
M
Michał Bert committed
3f1bf74debe156a30972f8fb1224421e1a73716b
Parent: 50ae6a1
Committed by GitHub <noreply@github.com>
on 8/13/2026, 9:14:18 AM