about summary refs log tree commit diff
path: root/src/view/com/pager/DraggableScrollView.tsx
diff options
context:
space:
mode:
authorAnsh Nanda <anshnanda10@gmail.com>2023-05-24 15:04:30 -0700
committerAnsh Nanda <anshnanda10@gmail.com>2023-05-24 15:04:30 -0700
commit32c9dabb7467149baf39d8f5c2eb3d0b81236d92 (patch)
tree4e6fc79bd3fe824d60b748d8fbb85159406fcd44 /src/view/com/pager/DraggableScrollView.tsx
parent7e555ecc1b04fed96192d3c68b87cf679993abfa (diff)
downloadvoidsky-32c9dabb7467149baf39d8f5c2eb3d0b81236d92.tar.zst
make tab bar scroll view draggable on web
Diffstat (limited to 'src/view/com/pager/DraggableScrollView.tsx')
-rw-r--r--src/view/com/pager/DraggableScrollView.tsx15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/view/com/pager/DraggableScrollView.tsx b/src/view/com/pager/DraggableScrollView.tsx
new file mode 100644
index 000000000..4b7396eaa
--- /dev/null
+++ b/src/view/com/pager/DraggableScrollView.tsx
@@ -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} />
+})