Skip to content

fix(ui): swipe action gesture handlers desynchronized on prop updates #30

Description

@arnauda-gh

Description

When modifying swipe action configuration in settings (e.g. changing action to delete), swiping an email list row visually displays the updated action (red background, Trash icon, 'Delete' label), but releasing the gesture executes the stale previous action (e.g. 'mark as read').

Root Cause

SwipeableRow creates its PanResponder instance once on mount via useRef(PanResponder.create(...)).current. The onPanResponderRelease callback closed over the initial leftAction, rightAction, mode, and onAction props. When props update on existing mounted rows, the visual JSX layer re-renders with new props, but the PanResponder gesture handler continues executing the stale closure.

Fix

Maintain mutable useRef instances for leftAction, rightAction, mode, and onAction inside SwipeableRow, updated on every render. PanResponder handlers read .current from these refs to execute with up-to-date props.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions