Carousel - Detecting current item
See original GitHub issueHi, how would you go about detecting the current position that the carousel has snapped to, given that setNumViewsToShowOnScreen
is set to 1?
`void buildModels() {
List<PhotoViewModel_> photoModels = new ArrayList(); for (photo in photos) { photoModels.add(new PhotoViewModel_() .id(photo.id()) .url(photo.url)) }
new CarouselModel_() .id(“carousel”) .models(photoModels) .addTo(this); }`
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
React-Bootstrap carousel slider: how to detect current slide in ...
1. You have to make the carousel a controlled component, and track the active index in state. · I saw the documentation, but...
Read more >Configure CarouselView interaction - .NET MAUI
The currently displayed item in a .NET MAUI CarouselView can be accessed through the CurrentItem and Position properties.
Read more >Carousel — Kivy 2.1.0 documentation
It will detect a swipe gesture according to the Carousel.scroll_timeout and ... It is None if the current slide is the last slide...
Read more >accessible-slick - the last (accessible) carousel you'll ever need
You still need to call $(element).slick() to initialize slick on the element. ... this current slide of this carousel will change the current...
Read more >Options - Splide
Determines whether to pause autoplay while the carousel contains the active element (focused element). This should be true for accessibility. resetProgress.
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 Free
Top 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
Thanks, @denison-chua. I did something simpler by just overriding
onScrollStateChanged
and calling a callback prop in it when the Recycler view state is idle.Hi @idrisadetunmbi , what I did was create a subclass of Carousel and then override addOnScrollListener and set a RecyclerView.OnScrollListener on your EpoxyController.
Here is my code for my Carousel subclass: ` @ModelView(saveViewState = true, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT) public class CustomEpoxyCarousel extends Carousel {
} `
And here is the code snippet inside my EpoxyController:
CustomEpoxyCarouselModel_ walletCarouselModel; walletCarouselModel = new CustomEpoxyCarouselModel_() .id("carouselWallet") .models(walletEpoxyModel_list) .padding(Carousel.Padding.dp( 10, //left 0, //top 10, //right 0, //bottom 0 //itemspacing )) .addOnScrollListener(getWalletScrollListener()) .numViewsToShowOnScreen(numViewsToShow); walletCarouselModel.addTo(this);