Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel: switching interval to false does not deactivate autoplay directly #2779

Open
MariusJam opened this issue Nov 8, 2023 · 0 comments · May be fixed by #2791
Open

Carousel: switching interval to false does not deactivate autoplay directly #2779

MariusJam opened this issue Nov 8, 2023 · 0 comments · May be fixed by #2791

Comments

@MariusJam
Copy link

MariusJam commented Nov 8, 2023

  • components: carousel
  • reactstrap version #8.10.1
  • react version #17.0.2
  • bootstrap version #4.5.2

What is happening?

With the Carousel, we can deactivate the autoplay by setting the interval props to false. However, this is not taken into account directly but only after one last automatic transition to the next slide. I think this is due to the the following piece of code in carousel.js :

componentDidUpdate(prevProps, prevState) {
    if (prevState.activeIndex === this.state.activeIndex) return;
    this.setInterval();
  }

An additional check between prevState.interval and this.state.interval should be perform before returning without setting the interval, no?

What should be happening?

Autoplay should stop as soon as the interval is set to false

Steps to reproduce issue

  1. Load the component with an interval
  2. Switch the interval to false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant