andyyou / react-coverflow

A Coverflow effect component of React version made for the web.
http://andyyou.github.io/react-coverflow/
MIT License
346 stars 143 forks source link

Switching out photos doesn't reset scroll position #4

Closed shinynet closed 6 years ago

shinynet commented 8 years ago

I use a button bar to swap out and load a different set of images into the cover flow. For example, if the coverflow is currently scrolled to the 20th image, and then I load in a different set of images, it remains on the 20th image. The new set of images may have less than 20, which puts the component in a weird state.

Essentially, if a new set of images is swapped in, it should reset the scroll position to the center (or optionally) the beginning.

asalem1 commented 6 years ago

This functionality shouldn't exist within the plugin. A feasible solution for your implementation would be to simply set the active prop to 0 upon loading a different set of images.