Skip to content

Commit d57bbb7

Browse files
authored
Fix initial position for circular (#8131)
1 parent bbab313 commit d57bbb7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

components/lib/carousel/Carousel.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,17 @@ export const Carousel = React.memo(
422422

423423
if (!carouselStyle.current) {
424424
calculatePosition();
425-
changePosition(totalShiftedItemsState);
425+
426+
// Workaround: force correct initial position for circular
427+
if (isCircular) {
428+
const initialPosition = -1 * numVisibleState;
429+
430+
setTotalShiftedItemsState(initialPosition);
431+
changePosition(initialPosition);
432+
} else {
433+
changePosition(totalShiftedItemsState);
434+
}
435+
426436
bindWindowResizeListener();
427437
}
428438
});

0 commit comments

Comments
 (0)