about summary refs log tree commit diff
path: root/src/view/com/pager/DraggableScrollView.tsx
blob: 4b7396eaa94e83e54225ca35197903cc15a85425 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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} />
})