Index attribute does not update the carousel element being displayed
See original GitHub issueI’m working on something that require the carousel to switch element programmatically, I have something like the following:
<Carousel index={activeChapter} autoPlay={false} animation="slide" navButtonsAlwaysInvisible={true} swipe={false}>
<div key={0}>0</div>
<div key={1}>1</div>
<div key={2}>2</div>
</Carousel>
The activeChapter
is a number stored in redux. However when activeChapter updates, the carousel does not switch page.
It appears that the carousel only respects the initial value of activeChapter
shows the correct corresponding page upon initial render, but would not update when the activeChapter
changes.
I’m currently using react v17, mui v5.2.
Am I using the index
attribute wrong, or is this a bug?
Sincerely, Oscar
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Problems with `track by $index` with Angular UI Carousel
When the carousel is first loaded, the index is 0. When it moves to the next slide the index is 1, when you...
Read more >Carousel - Bootstrap
The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It...
Read more >Auto-Rotating Image Carousel Example with Buttons for Slide ...
In the view of this carousel where the controls and captions are displayed inside the image, background images could cause color contrast for...
Read more ><af:carousel> - Oracle Help Center
The number of rows that are displayed on the client should generally be just ... Attribute change events are not delivered for any...
Read more >ons-carousel - Onsen UI
The <ons-carousel> element has a large number of attributes that control its behavior. By default the carousel can not be controlled by swiping....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in 3.1.1
I’m seeing the same bug in 3.2.0
@Learus Could you please take a look at this? Thank you very much…