Closed bogdancss closed 11 months ago
Hi, @bogdancss! EventType.UPDATE
fires when you have changed the activeIndex
property (the gallery has been moved programmatically, without using a button action).
If you add/remove elements, you know what you are doing and what happened. Accordingly you can call callback after those actions.
It possible to reopen the issue with feature request label if you don't resolve your case.
@maxmarinich I get that, but I need the carousel to trigger an update method to update the isNextSlideDisabled
and isPrevSlideDisabled
props based on the new number of items
@maxmarinich - can you get back to the question above?
@maxmarinich we really this this addressed - is there a solution?
we have the carousel not render the prev/next buttons when it's not the case to (the number of items fits within the current view)
also, we have the buttons disabled based on isNextSlideDisabled
and isPrevSlideDisabled
props the carousel provides.
However, the moment the number of items changes so that there are more than the current view fits we want the prev/next buttons to render.
The only way to make the buttons show up after you add an item, is to resize, which in turn triggers the isNextSlideDisabled
isPrevSlideDisabled
to update.
There should be a way to do this onUpdate
and not just onResize
or onInit
Added at v2.8.0 see https://maxmarinich.github.io/react-alice-carousel/#events
We have a check that disables the prev/next carousel buttons based on
isNextSlideDisabled
andisPrevSlideDisabled
from the carouselEventObject
. I get access to this event in theonResized
andonInitialized
methods which works fine on init or resize.However we have the ability to add/remove items after init - when we add/remove am item to/from the carousel, we need to update the prev/next buttons. Obviously the
onResized
andonInitialized
methods are not triggered here, so there is no way to determine if these buttons should be active or not.I noticed the UPDATE event is there, just there is not way to subscribe to it: