main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
663 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import { parseMergedHandlers } from '@use-gesture/core'
|
---|
| 2 | import { registerAction } from '@use-gesture/core/actions'
|
---|
| 3 | import { Action, GestureHandlers, UserGestureConfig } from '@use-gesture/core/types'
|
---|
| 4 | import { useRecognizers } from './useRecognizers'
|
---|
| 5 |
|
---|
| 6 | export function createUseGesture(actions: Action[]) {
|
---|
| 7 | actions.forEach(registerAction)
|
---|
| 8 |
|
---|
| 9 | return function useGesture<Config extends UserGestureConfig = UserGestureConfig>(
|
---|
| 10 | _handlers: GestureHandlers,
|
---|
| 11 | _config?: Config
|
---|
| 12 | ) {
|
---|
| 13 | const { handlers, nativeHandlers, config } = parseMergedHandlers(_handlers, _config || {})
|
---|
| 14 | return useRecognizers<Config>(handlers, config, undefined, nativeHandlers)
|
---|
| 15 | }
|
---|
| 16 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.