React-slick: Slider does not go to first slide when changing route with react-router

Created on 22 Sep 2015  路  5Comments  路  Source: akiran/react-slick

SEE: https://github.com/akiran/react-slick/issues/85

I am changing the route using <Link> (provided by react-router), but when doing so it keeps the slider on the currentSlide (Even though the slider's data changes).

SEE: https://github.com/akiran/react-slick/issues/100

  1. Navigate to item A page
  2. Show a list of related items in the slider
  3. Click on related item B
  4. Navigate to item B page
  5. Show a list of related items in the slider (They may or may not be the same items in step 2鈥擳he current page will reflect the previous list in step 2)

Perhaps there is a middle ground between all of these related issues to enable reseting currentSlide: 0?

stale

Most helpful comment

first

second
componentWillReceiveProps(nextProps) {
if(this.props.~~ != nextProps.~~) {
this.setSlideRest(this);
}
}
setSlideRest(obj) {
obj.refs && obj.refs.slider && obj.refs.slider.slickGoTo(0);
}

All 5 comments

Yep, I am facing the same issue here.

+1
is there no one still solve this problem?

+1
Should have an option to let currentSlide reset to 0 when the Slider component updates

first

second
componentWillReceiveProps(nextProps) {
if(this.props.~~ != nextProps.~~) {
this.setSlideRest(this);
}
}
setSlideRest(obj) {
obj.refs && obj.refs.slider && obj.refs.slider.slickGoTo(0);
}

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rohitgoyal7 picture rohitgoyal7  路  3Comments

BradyEdgar94 picture BradyEdgar94  路  3Comments

vugman picture vugman  路  3Comments

adamthewan picture adamthewan  路  4Comments

enriquelopez-atlas picture enriquelopez-atlas  路  3Comments