yaodingyd / react-flickity-component

A React.js component for using @desandro's Flickity
314 stars 51 forks source link

Flickity initialIndex prop not working #34

Closed csantos1113 closed 6 years ago

csantos1113 commented 6 years ago

Since the 2.0.0 version of this component, the initialIndex property is not working:

import React from "react";
import { render } from "react-dom";
import Flickity from "react-flickity-component";

const flickityOptions = {
  initialIndex: 7
};

function Carousel() {
  return (
    <Flickity options={flickityOptions}>
      <img src="http://via.placeholder.com/50x150" />
      <img src="http://via.placeholder.com/100x150" />
      <img src="http://via.placeholder.com/150x150" />
      <img src="http://via.placeholder.com/250x150" />
      <img src="http://via.placeholder.com/300x150" />
      <img src="http://via.placeholder.com/350x150" />
      <img src="http://via.placeholder.com/350x150" />
      <img src="http://via.placeholder.com/350x150" />
      <img src="http://via.placeholder.com/350x150" />
    </Flickity>
  );
}
render(<Carousel />, document.getElementById("root"));

See the live example: https://codesandbox.io/s/lljo6rkx2q

yaodingyd commented 6 years ago

Thanks for reporting this bug. I'm working on a fix.