Carousel with dynamic data
See original GitHub issueI’m using your carousel project. I wanted to bind 1000 items to carousel. My code works, but when i update state of carouselData, app is waiting almost 10 seconds. This wait is so long for user experience. And carousel strange behaviour. Like this video. I want to pass one by one. How can i fast update data. I bind data like this on onSnapToItem event:
<Carousel
ref={(c) => { this.carousel = c; }}
data={this.state.carouselData}
....
onSnapToItem={(index) => {
if(index%4==0)
{
const lastArr = this.arrContent.slice(index + 1, index + 6);
this.setState({
carouselData: [...this.state.carouselData, ...lastArr]
});
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Dynamic product carousels | Algolia
Display search results in carousels. The dynamic carousel lets you change the list of carousels from the dashboard without editing the front ...
Read more >Dynamic carousel with dynamic content | Mendix Forum
Greetings, I need a dynamic carousel where I can have any number of slides. Example: could have either 2 slides or 20 slides...
Read more >Carousel - dynamic - CodePen
1. var carousel = document.querySelector('.carousel'); ; 2. var cells = carousel.querySelectorAll('.carousel__cell'); ; 3. var cellCount; // cellCount set from ...
Read more >how to create a a bootstrap Carousel with dynamic image ...
the first image in bootstrap carousel requires it to be active so just put a ternary operator to check for index and if...
Read more >Bootstrap Dynamic Carousel on Codeply
Dynamic Bootstrap Carousel with jQuery Codeply example.
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
The issue I’m getting with dynamic data is that I’m trying to always have a set of 3 items, swap out the first and last, but then Carousel never recognizes that there are more than 3 items in the array.
Does anyone have an example of how they solved this or got around it?
So I have this:
data = [first, second, third]
and I have logic that’s constantly updating all three images, but the Carousel will only ever let me swipe to the 3 items.@egvrcn You’re welcome! Thanks for the feedback on
shouldComponentUpdate
by the way.I’m going to close the issue because there is only so much we can do about it. Let’s follow
FlatList
’s evolution closely and post any meaningful update to this thread 😉I’ll make sure to add everything we’ve shared so far to the doc; it can prove useful for other users.