main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
677 bytes
|
Line | |
---|
1 | import { registerAction, dragAction } from '@use-gesture/core/actions'
|
---|
2 | import { EventTypes, Handler, UserDragConfig } from '@use-gesture/core/types'
|
---|
3 | import { useRecognizers } from './useRecognizers'
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Drag hook.
|
---|
7 | *
|
---|
8 | * @param {Handler<'drag'>} handler - the function fired every time the drag gesture updates
|
---|
9 | * @param {UserDragConfig} config - the config object including generic options and drag options
|
---|
10 | */
|
---|
11 | export function useDrag<EventType = EventTypes['drag'], Config extends UserDragConfig = UserDragConfig>(
|
---|
12 | handler: Handler<'drag', EventType>,
|
---|
13 | config?: Config
|
---|
14 | ) {
|
---|
15 | registerAction(dragAction)
|
---|
16 | return useRecognizers({ drag: handler }, config || {}, 'drag')
|
---|
17 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.