Skip to content

Commit

Permalink
fix(snackbar): adds timer pause during swipe gesture
Browse files Browse the repository at this point in the history
  • Loading branch information
soykje committed Jun 13, 2024
1 parent 9fce4dc commit ea40f6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/components/snackbar/src/SnackbarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ export const SnackbarItem = forwardRef<HTMLDivElement, PropsWithChildren<Snackba

const { state: swipeState, direction: swipeDirection } = useSwipe({
swipeRef: ref,
onSwipeStart: state.pauseAll,
onSwipeCancel: state.resumeAll,
onSwipeEnd: ({ direction }) => {
;['left', 'right'].includes(`${direction}`) && state.close(toast.key)
state.resumeAll()
},
})

Expand Down

0 comments on commit ea40f6f

Please sign in to comment.