akiran / react-slick

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

React slick adding slick-list class to slick-arrow #1480

Open ghost opened 5 years ago

ghost commented 5 years ago

Hi, this is my slider config:

slidesToShow: 4,
slidesToScroll: 4,
initialSlide: 0,
dots: false,
infinite: false,
responsive: [
  {
    breakpoint: BREAKPOINT_XL,
    settings: {
      dots: false
    }
  },
  {
    breakpoint: BREAKPOINT_LG,
    settings: {
      slidesToShow: 4,
      slidesToScroll: 4,
      dots: false
    }
  },
  {
    breakpoint: BREAKPOINT_MD,
    settings: {
      slidesToShow: 2,
      slidesToScroll: 2,
      dots: false
    }
  },
  {
    breakpoint: BREAKPOINT_SM,
    settings: {
      slidesToShow: 1,
      slidesToScroll: 1,
      dots: false
    }
  }
]

I am using custom arrows for slider:

export const NextArrowCustom = props => {
  const { className, onClick } = props;
  return (
    <StyledCustomArrow className={className} onClick={onClick}>
      <StyledArrowIcon className="nc-ic_keyboard_arrow_right_48px" />
    </StyledCustomArrow>
  );
};

On smallest breakpoint for unknown reason react-slick id adding slick-list class to arrow component. When there is more then 4 items in slider it works as expected.

Thanks.

avkvak commented 5 years ago

same problem here. My config contains following:

  nextArrow: <CardSliderArrow />,
  prevArrow: <CardSliderArrow />,

CardSliderArrow:

const CardSliderArrow = ({ onClick }) => {
  return (
    <CardSliderArrowStyled {...{ onClick }}>
      Arrow Here
    </CardSliderArrowStyled>
  );
};

but I finally Ive got these: https://cl.ly/51b9787b94d8

highlighted line is an buggy arrow

StevenGastroSophy commented 4 years ago

try to replace the first tag of arrow with "non-div" tag. it would be just fine~