make tab bar scroll view draggable on web
This commit is contained in:
parent
7e555ecc1b
commit
32c9dabb74
5 changed files with 130 additions and 3 deletions
15
src/view/com/pager/DraggableScrollView.tsx
Normal file
15
src/view/com/pager/DraggableScrollView.tsx
Normal 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} />
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue