khanglu / react-crossfade-image

react-crossfade-image - Simple React component for crossfading images - No CSS needed
MIT License
33 stars 13 forks source link

Does not work with React 16 #3

Open oleksandr-yefremov opened 6 years ago

oleksandr-yefremov commented 6 years ago

I was trying to do setInterval(this.changeImage, 1000), but got a crash immediately. package.json uses "react": "^15.5.4", while I am using React 16. Looks like it is the same issue as this one - https://github.com/facebook/react/issues/10320#issuecomment-318754280

TypeError: this.updater.enqueueCallback is not a function
CrossfadeImage../node_modules/react-crossfade-image/node_modules/react/lib/ReactBaseClasses.js.ReactComponent.setState
node_modules/react-crossfade-image/node_modules/react/lib/ReactBaseClasses.js:64
  61 |   !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
  62 |   this.updater.enqueueSetState(this, partialState);
  63 |   if (callback) {
> 64 |     this.updater.enqueueCallback(this, callback, 'setState');
  65 |   }
  66 | };
  67 | 
khanglu commented 6 years ago

Thanks, I updated the dependencies to use React 16.