Skip to content

Commit

Permalink
Merge pull request #81 from vadymshymko/fix-disabled-update
Browse files Browse the repository at this point in the history
Fix disabled update
  • Loading branch information
vadymshymko authored Feb 9, 2023
2 parents 874b93c + cd1e156 commit 1973974
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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/"
Expand Down
7 changes: 5 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ function ReactSimplyCarousel({
const innerRef = useRef<HTMLDivElement>(null);
const itemsListRef = useRef<HTMLDivElement>(null);

const itemsListDragStartPosRef = useRef<number>(0);
const itemsListDragStartPosRef = useRef(0);
const isListDraggingRef = useRef(false);
const isListTransitionBrokenRef = useRef(false);

const directionRef = useRef<NavDirection | ''>('');

Expand Down Expand Up @@ -807,7 +808,7 @@ function ReactSimplyCarousel({
directionRef.current = '';

if (activeSlideIndex !== positionIndex) {
if (!speed && !delay) {
if ((!speed && !delay) || isListTransitionBrokenRef.current) {
setPositionIndex(activeSlideIndex);
}
} else {
Expand Down Expand Up @@ -894,6 +895,8 @@ function ReactSimplyCarousel({

renderedSlidesCountRef.current = 0;
firstRenderSlideIndexRef.current = positionIndex;
isListTransitionBrokenRef.current =
itemsListRef.current?.style.transform === itemsListTransform;

return (
<div
Expand Down

0 comments on commit 1973974

Please sign in to comment.