import { type RefObject } from 'react'; import { type CallbackSetter } from './shared/types'; /** * Returns a frozen object of callback setters to handle the touch events.
* It accepts a DOM ref representing the events target.
* If a target is not provided the events will be globally attached to the document object. *
* ### Shall the `useTouchEvents` callbacks replace the standard mouse handler props? * * **They shall not!**
* **useTouchEvents is meant to be used to abstract more complex hooks that need to control mouse**, for instance: * a drag n drop hook.
* Using useTouchEvents handlers instead of the classic props approach it's just as bad as it sounds since you'll * lose the React SyntheticEvent performance boost.
* If you were doing something like the following: * */ declare const useTouchEvents: (targetRef?: RefObject | undefined, passive?: boolean) => Readonly; /** * The return object of the `useTouchEvents` hook. */ export interface UseTouchEventsReturn { onTouchStart: CallbackSetter; onTouchEnd: CallbackSetter; onTouchCancel: CallbackSetter; onTouchMove: CallbackSetter; } export default useTouchEvents;