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.
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
SwipeableRowcreates itsPanResponderinstance once on mount viauseRef(PanResponder.create(...)).current. TheonPanResponderReleasecallback closed over the initialleftAction,rightAction,mode, andonActionprops. When props update on existing mounted rows, the visual JSX layer re-renders with new props, but thePanRespondergesture handler continues executing the stale closure.Fix
Maintain mutable
useRefinstances forleftAction,rightAction,mode, andonActioninsideSwipeableRow, updated on every render.PanResponderhandlers read.currentfrom these refs to execute with up-to-date props.