about summary refs log tree commit diff
path: root/src/view/com/pager/DraggableScrollView.tsx
blob: fc06b72e82996e2d95acd2cb94db0c2cf12f1e1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import React, {ComponentProps} from 'react'
import {ScrollView} from 'react-native'

import {useDraggableScroll} from '#/lib/hooks/useDraggableScrollView'

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} />
})