Skip to content

Commit

Permalink
chore: 复原scroll-view
Browse files Browse the repository at this point in the history
  • Loading branch information
lareinayanyu committed Nov 5, 2024
1 parent 21c8e95 commit 1c9d049
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
const nodeRef = useRef<View>(null)

useNodesRef(props, ref, nodeRef, {
defaultStyle: normalStyle,
defaultStyle: styles.container,
gestureRef: movableGestureRef
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,12 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
}

function onContentSizeChange (width: number, height: number) {
scrollOptions.current = {
...scrollOptions.current,
contentLength: selectLength({ height, width })
}
scrollOptions.current.contentLength = selectLength({ height, width })
}

function onLayout (e: LayoutChangeEvent) {
const layout = e.nativeEvent.layout || {}
scrollOptions.current = {
...scrollOptions.current,
visibleLength: selectLength(layout)
}
scrollOptions.current.visibleLength = selectLength(layout)
}

function updateScrollOptions (e: NativeSyntheticEvent<NativeScrollEvent>, position: Record<string, any>) {
Expand Down Expand Up @@ -443,11 +437,9 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
ref: scrollViewRef,
onScroll: onScroll,
onContentSizeChange: onContentSizeChange,
...(enhanced && {
...(binddragstart && { bindtouchstart: onScrollTouchStart }),
...(binddragging && { bindtouchmove: onScrollTouchMove }),
...(binddragend && { bindtouchend: onScrollTouchEnd })
}),
bindtouchstart: onScrollTouchStart,
bindtouchmove: onScrollTouchMove,
bindtouchend: onScrollTouchEnd,
onScrollBeginDrag: onScrollDrag,
onScrollEndDrag: onScrollDrag,
onMomentumScrollEnd: onScrollEnd,
Expand Down

0 comments on commit 1c9d049

Please sign in to comment.