Skip to content

Commit

Permalink
Don't reset scroll at scrollend
Browse files Browse the repository at this point in the history
This happens automatically due to the scroll snapping.
  • Loading branch information
sebmarkbage committed Feb 21, 2025
1 parent 43b0be9 commit 2134505
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions fixtures/view-transition/src/components/SwipeRecognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,14 @@ export default function SwipeRecognizer({
}
// Reset scroll
if (changed) {
resetScroll(!direction);
// Trigger side-effects
startTransition(action);
} else {
resetScroll(direction);
}
}

function resetScroll(dir) {
useEffect(() => {
const scrollElement = scrollRef.current;
switch (dir) {
switch (direction) {
case 'left':
scrollElement.scrollLeft =
scrollElement.scrollWidth - scrollElement.clientWidth;
Expand All @@ -85,10 +82,6 @@ export default function SwipeRecognizer({
default:
break;
}
}

useEffect(() => {
resetScroll(direction);
}, [direction]);

const scrollStyle = {
Expand Down

0 comments on commit 2134505

Please sign in to comment.