diff --git a/packages/uikit/src/scroll.tsx b/packages/uikit/src/scroll.tsx index 91c5834c..bb4eda24 100644 --- a/packages/uikit/src/scroll.tsx +++ b/packages/uikit/src/scroll.tsx @@ -120,19 +120,20 @@ export function ScrollHandler({ enableRubberBand: boolean, ) => { const [wasScrolledX, wasScrolledY] = event == null ? [false, false] : getWasScrolled(event.nativeEvent) - if (wasScrolledX && wasScrolledY) { - return + if (wasScrolledX) { + deltaX = 0 + } + if (wasScrolledY) { + deltaY = 0 } const [x, y] = scrollPosition.value const [maxX, maxY] = node.maxScrollPosition.value let [newX, newY] = scrollPosition.value const [ancestorScrollableX, ancestorScrollableY] = node.anyAncestorScrollable?.value ?? [false, false] - if (!wasScrolledX) { - newX = computeScroll(x, maxX, deltaX, enableRubberBand && !ancestorScrollableX) - } - if (!wasScrolledY) { - newY = computeScroll(y, maxY, deltaY, enableRubberBand && !ancestorScrollableY) - } + + newX = computeScroll(x, maxX, deltaX, enableRubberBand && !ancestorScrollableX) + newY = computeScroll(y, maxY, deltaY, enableRubberBand && !ancestorScrollableY) + if (deltaTime != null && deltaTime > 0) { scrollVelocity.set(deltaX, deltaY).divideScalar(deltaTime) }