Skip to content

Commit

Permalink
Merge pull request #168 from vadymshymko/167-when-items-to-scroll-is-…
Browse files Browse the repository at this point in the history
…greater-than-the-actual-children-swipe-by-mouse-or-touch-are-malfunctioning

Fix calculate is all slides visible
  • Loading branch information
vadymshymko authored Jun 22, 2023
2 parents c3f460a + 7f13f22 commit a5eb87d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ function ReactSimplyCarousel({
} = (dotsNav as DotsNav) || {};

const lastSlideIndex = Children.count(children) - 1;
const isAllSlidesVisible = itemsToShow === slidesItems.length;
const isAllSlidesVisible =
!!windowWidth &&
innerRef.current?.offsetWidth! >= itemsListRef.current?.offsetWidth!;
const hideNav = hideNavIfAllVisible && isAllSlidesVisible;
const disableNav = disableNavIfAllVisible && isAllSlidesVisible;
const itemsListTransition =
Expand Down

0 comments on commit a5eb87d

Please sign in to comment.