From 3669b0a44b0d26a97dc3612ea7ff1ed7dbcfda82 Mon Sep 17 00:00:00 2001 From: rjsdnql123 Date: Thu, 25 Jan 2024 00:41:37 +0900 Subject: [PATCH] Fix: If the element (DOM element) and the value of 'slidesToShow' are the same, and 'infinite' is set to true, swipe should be possible. --- src/slider.js | 2 +- src/track.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/slider.js b/src/slider.js index 65d63a4b5..82c91a912 100644 --- a/src/slider.js +++ b/src/slider.js @@ -198,7 +198,7 @@ export default class Slider extends React.Component { if (settings === "unslick") { const className = "regular slider " + (this.props.className || ""); return
{children}
; - } else if (newChildren.length <= settings.slidesToShow) { + } else if (newChildren.length <= settings.slidesToShow && !settings.infinite) { settings.unslick = true; } return ( diff --git a/src/track.js b/src/track.js index f8924c826..2378d048d 100644 --- a/src/track.js +++ b/src/track.js @@ -138,8 +138,7 @@ const renderSlides = spec => { if (spec.infinite && spec.fade === false) { let preCloneNo = childrenCount - index; if ( - preCloneNo <= getPreClones(spec) && - childrenCount !== spec.slidesToShow + preCloneNo <= getPreClones(spec) ) { key = -preCloneNo; if (key >= startIndex) { @@ -164,7 +163,6 @@ const renderSlides = spec => { ); } - if (childrenCount !== spec.slidesToShow) { key = childrenCount + index; if (key < endIndex) { child = elem; @@ -186,7 +184,6 @@ const renderSlides = spec => { } }) ); - } } });