Use updated props in PanResponder callbacks
Issue: Using useRef memoizes initial disable value. So the swipe functionality continues to work though the disabled prop is set as true.
Fix: Use useCallback instead of useRef to update PanResponder callbacks every time props update
Example:
const MyComponent = (props) => {
const [disableSwipeButton, setDisableSwipeButton] = useState(false)
return (
<div>
<RNSwipeButton disabled={disableSwipeButton} />
<Button onPress={() => setDisableSwipeButton(!disableSwipeButton)} title="Toggle disable" />
</div>
)
}