Skip to content

Commit

Permalink
fix(SwipeAction): fix close on touch outside and interaction between …
Browse files Browse the repository at this point in the history
…SwipeActions
  • Loading branch information
zqran committed Jul 27, 2022
1 parent dbddbce commit 8f4fb48
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/swipe-action/swipe-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,17 @@ export const SwipeAction = forwardRef<SwipeActionRef, SwipeActionProps>(
function forceCancelDrag() {
dragCancelRef.current?.()
draggingRef.current = false
dragDownRef.current = false
}
const dragDownRef = useRef(false)

const bind = useDrag(
state => {
if (state.down) {
dragDownRef.current = state.down
}
if (!dragDownRef.current) return

dragCancelRef.current = state.cancel
if (!state.intentional) return
draggingRef.current = true
Expand Down

0 comments on commit 8f4fb48

Please sign in to comment.