akiran / react-slick

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

Fix for Partial Sliders with Adaptive Height Disappearance Issue #2355

Closed ribonuclecode closed 3 months ago

ribonuclecode commented 4 months ago

Description:

This pull request addresses the issue where sliders disappear when attempting to display a partial number of sliders with the adaptiveHeight property set to true. The implemented solution involves considering the slider with the slick-current classname as the current slider.

Changes made:

✅ Modified the height calculation to consider the slider marked as slick-current as the current one. ✅ Added a test that ensures partial sliders with adaptive height are displayed correctly.

Demonstrations:

https://github.com/akiran/react-slick/assets/16759154/2fd4d9aa-84ef-4300-a714-8a38cd8eb941

https://github.com/akiran/react-slick/assets/16759154/9665496e-0dbd-410e-9dc3-bf2a7420dcc0

How to Test the Changes:

  1. Add an odd number of sliders greater than the unit, for example 3 slides.
  2. In the settings, indicate that you only want to show with slidesToShow 2.5 slides, which would be 2 sliders and partially the next one. The centerMode and infinite field must be disabled.
  3. Drag to the left slider to check that they are partially displayed.

Additional Notes:

👍 Checked that the other tests work perfectly 👍 Checked if the change of getting the current slider with slider-current affects other part of the project