File size: 677 Bytes
bf237c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { registerAction, moveAction } from '@use-gesture/core/actions'
import { UserMoveConfig, Handler, EventTypes } from '@use-gesture/core/types'
import { useRecognizers } from './useRecognizers'

/**
 * Move hook.
 *
 * @param {Handler<'move'>} handler - the function fired every time the move gesture updates
 * @param {UserMoveConfig} config - the config object including generic options and move options
 */
export function useMove<EventType = EventTypes['move'], Config extends UserMoveConfig = UserMoveConfig>(
  handler: Handler<'move', EventType>,
  config?: Config
) {
  registerAction(moveAction)
  return useRecognizers({ move: handler }, config || {}, 'move')
}