diff --git a/package.json b/package.json index 43e6591..ff700da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-simply-carousel", - "version": "8.4.5", + "version": "8.4.6", "description": "A simple, lightweight, fully controlled isomorphic (with SSR support) React.js carousel component. Touch enabled and responsive. With support for autoplay and infinity options. Fully customizable", "files": [ "dist/" diff --git a/src/index.tsx b/src/index.tsx index 38d51d0..fb92d98 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -93,8 +93,9 @@ function ReactSimplyCarousel({ const innerRef = useRef(null); const itemsListRef = useRef(null); - const itemsListDragStartPosRef = useRef(0); + const itemsListDragStartPosRef = useRef(0); const isListDraggingRef = useRef(false); + const isListTransitionBrokenRef = useRef(false); const directionRef = useRef(''); @@ -807,7 +808,7 @@ function ReactSimplyCarousel({ directionRef.current = ''; if (activeSlideIndex !== positionIndex) { - if (!speed && !delay) { + if ((!speed && !delay) || isListTransitionBrokenRef.current) { setPositionIndex(activeSlideIndex); } } else { @@ -894,6 +895,8 @@ function ReactSimplyCarousel({ renderedSlidesCountRef.current = 0; firstRenderSlideIndexRef.current = positionIndex; + isListTransitionBrokenRef.current = + itemsListRef.current?.style.transform === itemsListTransform; return (