UNPKG

beautiful-react-hooks

Version:

A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development

17 lines (16 loc) 533 B
import useSwipe from './useSwipe'; const defaultOptions = { threshold: 15, preventDefault: true, }; /** * A shortcut to useSwipe (with vertical options) * @param ref * @param options * @return {{alpha: number, count: number, swiping: boolean, direction: null}} */ const useVerticalSwipe = (ref, options = defaultOptions) => { const opts = Object.assign(Object.assign(Object.assign({}, defaultOptions), (options || {})), { direction: 'vertical' }); return useSwipe(ref, opts); }; export default useVerticalSwipe;