feat: Added swipe gestures for dismissing panes on mobile (#2201)

This commit is contained in:
Aman Harwara
2023-02-07 12:51:16 +05:30
committed by GitHub
parent f0d49f6b21
commit 1d052c3dd1
10 changed files with 205 additions and 14 deletions

View File

@@ -35,6 +35,7 @@ export const useLongPressEvent = (
}
elementRef.current.addEventListener('pointerdown', createLongPressTimeout)
elementRef.current.addEventListener('pointermove', clearLongPressTimeout)
elementRef.current.addEventListener('pointercancel', clearLongPressTimeout)
elementRef.current.addEventListener('pointerup', clearLongPressTimeout)
}, [clearLongPressTimeout, createLongPressTimeout, elementRef])
@@ -45,6 +46,7 @@ export const useLongPressEvent = (
}
elementRef.current.removeEventListener('pointerdown', createLongPressTimeout)
elementRef.current.addEventListener('pointermove', clearLongPressTimeout)
elementRef.current.removeEventListener('pointercancel', clearLongPressTimeout)
elementRef.current.removeEventListener('pointerup', clearLongPressTimeout)
}, [clearLongPressTimeout, createLongPressTimeout, elementRef])