diff --git a/src/lib/hooks/useDraggableScrollView.ts b/src/lib/hooks/useDraggableScrollView.ts index 3471d0d06c..05fda9a9fe 100644 --- a/src/lib/hooks/useDraggableScrollView.ts +++ b/src/lib/hooks/useDraggableScrollView.ts @@ -1,6 +1,6 @@ -import {ForwardedRef, useEffect, useMemo, useRef} from 'react' -import type {ScrollView} from 'react-native' -import {findNodeHandle, Platform} from 'react-native' +import {type ForwardedRef, useEffect, useMemo, useRef} from 'react' +import {type ScrollView} from 'react-native' +import {Platform} from 'react-native' import {mergeRefs} from '#/lib/merge-refs' @@ -19,7 +19,7 @@ export function useDraggableScroll({ if (Platform.OS !== 'web' || !ref.current) { return } - const slider = findNodeHandle(ref.current) as unknown as HTMLDivElement + const slider = ref.current as unknown as HTMLDivElement if (!slider) { return } diff --git a/src/view/com/pager/DraggableScrollView.tsx b/src/view/com/pager/DraggableScrollView.tsx index fc06b72e82..c98e340548 100644 --- a/src/view/com/pager/DraggableScrollView.tsx +++ b/src/view/com/pager/DraggableScrollView.tsx @@ -1,16 +1,25 @@ -import React, {ComponentProps} from 'react' +import {type ComponentPropsWithRef} from 'react' import {ScrollView} from 'react-native' import {useDraggableScroll} from '#/lib/hooks/useDraggableScrollView' +import {atoms as a, web} from '#/alf' -export const DraggableScrollView = React.forwardRef< - ScrollView, - ComponentProps ->(function DraggableScrollView(props, ref) { +export function DraggableScrollView({ + ref, + style, + ...props +}: ComponentPropsWithRef) { const {refs} = useDraggableScroll({ outerRef: ref, cursor: 'grab', // optional, default }) - return -}) + return ( + + ) +}