Skip to content

Commit 63e648c

Browse files
committed
chore(Scroller): fix horizontal scroll
1 parent 5a24f19 commit 63e648c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/scroller.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ class Scroller extends React.Component<IScrollerProps> {
112112
const nbRemovedParts = nbPrevIgnoredHorizontalParts - nbIgnoredHorizontalParts;
113113
// 1 if added or -1 if scrollable parts are removed ;
114114
const changeDirection = diff >= 0 ? -1 : 1;
115-
const newLeft = scrollLeft - newRelativeDiff + (changeDirection * newRelativeDiff) / nbRemovedParts;
116-
this.scrollToLeft(newLeft);
115+
if (nbRemovedParts !== 0) {
116+
const newLeft = scrollLeft - newRelativeDiff + (changeDirection * newRelativeDiff) / nbRemovedParts;
117+
this.scrollToLeft(newLeft);
118+
}
117119
}
118120
}
119121
};

0 commit comments

Comments
 (0)