beautiful-react-hooks
Version:
A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development
20 lines (19 loc) • 562 B
TypeScript
import { RefObject } from 'react';
import { Direction } from './shared/swipeUtils';
export declare type UseSwipeOptions = {
direction?: 'both' | 'horizontal' | 'vertical';
threshold?: number;
preventDefault?: boolean;
};
declare type LocalSwipeState = {
swiping: boolean;
direction?: Direction;
alphaX: number;
alphaY: number;
count: number;
};
/**
* useSwipe hook
*/
declare const useSwipe: <TElement extends HTMLElement>(targetRef?: RefObject<TElement>, options?: UseSwipeOptions) => LocalSwipeState;
export default useSwipe;