yaodingyd / react-flickity-component

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

refactor implementation with react portal #22

Closed yaodingyd closed 6 years ago

yaodingyd commented 6 years ago

This is mainly a implementation refactor with portal.

Additionally, there are some other changes:

  1. Update README with prop tables, API and event usage
  2. Update package.json, add peer dependencies, remove jsnext:main entry
  3. Add flickityRef prop for parent component to get Flickity instance
  4. Remove updateSelected in index.js, as 1) parent component can use Flickity ref to get selectedIndex 2) the internal state involved has no actual usage 3) this also triggers an unnecessary render
  5. Remove onSwipe prop as all events can and should be registered in parent component
  6. Update testcases
theolampert commented 6 years ago

thanks a lot for doing this @yaodingyd I'll take a look over it today and get back to you.

theolampert commented 6 years ago

@yaodingyd looks good to me, thanks for your work on this. We probably need to update the CI to install react and react-dom manually now that they're peer dependencies. If you could update .travis.yml with something like the following then I'll merge this and push a new version

install:
  - npm install
  - npm install react react-dom

https://docs.travis-ci.com/user/customizing-the-build/#Customizing-the-Installation-Step

yaodingyd commented 6 years ago

@theolampert Thanks! CI is updated.