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:
707 bytes
|
Line | |
---|
1 | import { registerAction, scrollAction } from '@use-gesture/core/actions'
|
---|
2 | import { UserScrollConfig, Handler, EventTypes } from '@use-gesture/core/types'
|
---|
3 | import { useRecognizers } from './useRecognizers'
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Scroll hook.
|
---|
7 | *
|
---|
8 | * @param {Handler<'scroll'>} handler - the function fired every time the scroll gesture updates
|
---|
9 | * @param {UserScrollConfig} config - the config object including generic options and scroll options
|
---|
10 | */
|
---|
11 | export function useScroll<EventType = EventTypes['scroll'], Config extends UserScrollConfig = UserScrollConfig>(
|
---|
12 | handler: Handler<'scroll', EventType>,
|
---|
13 | config?: Config
|
---|
14 | ) {
|
---|
15 | registerAction(scrollAction)
|
---|
16 | return useRecognizers({ scroll: handler }, config || {}, 'scroll')
|
---|
17 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.