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

fix(Carousel): fix issue where changing activeIndex won't work #6265

Merged
merged 1 commit into from Mar 10, 2022

Conversation

kyletsang
Copy link
Member

Issue was brought up in #6263

If you set the slides and then change the activeIndex, it will result in the carousel locking up because isSliding is set to true and RTG's onEntered isn't triggered to reset this.

Minimal repro:
https://codesandbox.io/s/react-bootstrap-carousel-active-index-forked-xht0f1?file=/src/App.js

Issue appears to be fixed by moving some of the code that handles the rendered active index into a useEffect hook.
Note, I had to tweak the delays of 1 test because the timers seem to be triggering too fast when testing.

Copy link
Collaborator

@golota60 golota60 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍 does this work when slide={false}?

@kyletsang
Copy link
Member Author

lgtm 👍 does this work when slide={false}?

Yup slide=false works 👍

@kyletsang kyletsang merged commit 0c7c5f7 into master Mar 10, 2022
@kyletsang kyletsang deleted the fix-carousel branch March 10, 2022 17:19
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 this pull request may close these issues.

None yet

2 participants