You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, when new props arrive, currentIndex stays as before. Hence when nextProps has more items than before, the gallery shows no image. I guess currentIndex should be reset in this case or is there some other way to do it right now?
The text was updated successfully, but these errors were encountered:
You can do so by adding a ref to the ImageGallery component
e.g.
classMyComponentextendsextendsReact.Component{_shouldResetGalleryIndex(nextProps){// Your logic goes here}componentWillReceiveProps(nextProps){if(this._shouldResetGalleryIndex(nextProps)&&this._imageGallery){this._imageGallery.slideToIndex(0)}}render(){<ImageGalleryref={i=>this._imageGallery=i}items={this.props.items}/>}}
Hi,
I noticed the following code has been removed some time ago
Right now, when new props arrive, currentIndex stays as before. Hence when
nextProps
has more items than before, the gallery shows no image. I guesscurrentIndex
should be reset in this case or is there some other way to do it right now?The text was updated successfully, but these errors were encountered: