Documentation
Hooks
useSwiping

useSwiping

Handle the user swipe actions on a container element.

12345678910

Type Definitions

type SwipeAction = {
    type: 'start' | 'moving' | 'end';
    deltaX: number;
    deltaY: number;
    initialX: number;
    initialY: number;
    event: PointerEvent;
};
type SwipeActionHandler = (action: SwipeAction) => any;
 
const useSwiping: <T extends HTMLElement>(args: {
    handler: SwipeActionHandler;
    ref?: React.RefObject<T> | null;
}) => React.RefObject<T>;
Last updated on