make tab bar scroll view draggable on web

This commit is contained in:
Ansh Nanda 2023-05-24 15:04:30 -07:00
parent 7e555ecc1b
commit 32c9dabb74
5 changed files with 130 additions and 3 deletions

View file

@ -0,0 +1,15 @@
import {useDraggableScroll} from 'lib/hooks/useDraggableScrollView'
import React, {ComponentProps} from 'react'
import {ScrollView} from 'react-native'
export const DraggableScrollView = React.forwardRef<
ScrollView,
ComponentProps<typeof ScrollView>
>(function DraggableScrollView(props, ref) {
const {refs} = useDraggableScroll<ScrollView>({
outerRef: ref,
cursor: 'grab', // optional, default
})
return <ScrollView ref={refs} horizontal {...props} />
})