akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.72k stars 2.1k forks source link

Bullets Points Rendering Issue #1451

Open driplo opened 5 years ago

driplo commented 5 years ago

Wrong Bullets Points Rendering

Sometimes react-slick fails to generate the right number of bullets points

Here react slicks should only render 2 bullets points, but there is 3, the last bullet point doesnt do anything

Reproduced with this config:

5 slides, 
slidesToShow: 3,
slidesToScroll: 2
isaacblinder commented 5 years ago

When the infinite prop is set to "True" (the default) the number of dots is Math.ceil(number of slides / slidesToScroll), whereas if the infinite prop is set to "False" the number of dots is Math.ceil((number of slides - slidesToShow) / slidesToScroll) + 1. If you set infinite=False as a prop you'll get two dots (and, of course, lose the ability for infinite scrolling).

the code for rendering dots (bullet points) is here --> https://github.com/akiran/react-slick/blob/master/src/dots.js