Account for momentum when hiding minimal shell (#3740)
* Add optional momentum events to scroll context * If there is a velocity, don't snap until momentum end * Don't show bar on scroll down * Rm onMomentumBegin
This commit is contained in:
parent
3b4848ba59
commit
1dd3d6657c
4 changed files with 59 additions and 15 deletions
|
@ -5,6 +5,7 @@ const ScrollContext = createContext<ScrollHandlers<any>>({
|
|||
onBeginDrag: undefined,
|
||||
onEndDrag: undefined,
|
||||
onScroll: undefined,
|
||||
onMomentumEnd: undefined,
|
||||
})
|
||||
|
||||
export function useScrollHandlers(): ScrollHandlers<any> {
|
||||
|
@ -20,14 +21,16 @@ export function ScrollProvider({
|
|||
onBeginDrag,
|
||||
onEndDrag,
|
||||
onScroll,
|
||||
onMomentumEnd,
|
||||
}: ProviderProps) {
|
||||
const handlers = useMemo(
|
||||
() => ({
|
||||
onBeginDrag,
|
||||
onEndDrag,
|
||||
onScroll,
|
||||
onMomentumEnd,
|
||||
}),
|
||||
[onBeginDrag, onEndDrag, onScroll],
|
||||
[onBeginDrag, onEndDrag, onScroll, onMomentumEnd],
|
||||
)
|
||||
return (
|
||||
<ScrollContext.Provider value={handlers}>{children}</ScrollContext.Provider>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue