React-slick: Default setting for slider isn't aligned left

Created on 5 Feb 2018  路  41Comments  路  Source: akiran/react-slick

On previous version (0.16.0), I could have the Slider to align left, but starting from 0.17.1, it doesn't have the same behavior.

Picture taken from: http://neostack.com/opensource/react-slick

image

On my project:
v 0.17.1:
image

v 0.16.0:
image

Both use the same settings:

  const sliderSettings = {
      autoplay: false,
      autoplaySpeed: 5000,
      pauseOnFocus: true,
      pauseOnHover: true,
      dots: false,
      arrows: false,
      infinite: false,
      speed: 500,
      slidesToScroll: 1,
      draggable: true,
      swipeToSlide: true,
      variableWidth: true,
    };

It's as if the Slider is forcing the component to align RIGHT instead of the usual LEFT in previous version of react-slick. Is this intended or a bug?

High

Most helpful comment

.slick-list> div {
margin-left:0;
}

This worked for me

All 41 comments

+1

+1

+1

+1

+++

++

+1

+1

+1

+1

+2

+1

This is not good. Is there a setting to configure this?

Tried rtl: true, that moved everything to the left, but it reversed the order and some of the items glitched and were missing/hidden.

The problem is related to transform on the slick-track. If you turn off that CSS property, it looks correct.

https://github.com/akiran/react-slick/commit/91199e49c2d6b07ead2fa6acef08096057cee133

That definitely has to be the problem. The track transition was rewritten and looks like it didn't account for lists with less than enough slides.

I'd recommend rolling back to 0.15.0 until this is fixed.

We're seeing this on v0.15.0 when we upgrade to react 16

Ok, it's not React 16. Just tested 0.15.0 with React 16 and that looks right. The problem started in [email protected] with the above mentioned PR.

Also tested 0.15.0 with React 16 and it looks correct. @FullstackJack is correct, i think

OK, sorry for the false alarm

If I use version 0.15.0 and up to 0.17.1 I have some extra space after the last item in the slider.
If I use version from 0.17.1 and upper I have some extra space at the start, before the first item.

React 16.

Is there any way to display it correctly, maybe I'm missing something?)))

I haven't had the chance to review to algo written in trackHelper, but the transform calculation is what needs fixing. I'll take a look today if I have some time.

Hi, I just wanted to ask, how many time approximately do you need to fix this bug? I am writing some new cool stuff and need this on prod.

On it!

071a29cea6e1b99f66cc49c20ed2c2e6131e3bb9

@laveesingh When do you plan to release these updates?

Probably by Monday

This is still happening even in 0.20.0, can we reopen this? @laveesingh

happening in 0.20.0 react 16. downgrading to 0.15.0 fixed the problem.

I'm not sure if that's happening in version 0.20.0. Could someone create a working demo for this on codesandbox?

@laveesingh sorry for taking so long. Here is a demo for the behavior at 0.20.0
https://codesandbox.io/s/3x7kl81pr5
https://3x7kl81pr5.codesandbox.io/

@akiran any update here? Still seeing this issue in 0.23.1

Came up with this problem today. The problem is that slick-track has a margin-left:auto and margin-right:auto by default. Changing those styles to 0 solved it for me.

So whats the fix for this ? stuck with the same problem ?

@shamseerahammedm They (@laveesingh) closed it with a "fix" that didn't actually work. You'd probably have to re-file the ticket to get any motion on it

.slick-list> div {
margin-left:0;
}

This worked for me

+1

+1

Whole problem is caused by infinite option. If you turn it down it will work fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ramyatrouny picture ramyatrouny  路  3Comments

artemidas picture artemidas  路  4Comments

rohitgoyal7 picture rohitgoyal7  路  3Comments

walker-jiang picture walker-jiang  路  3Comments

will88 picture will88  路  3Comments