react-spring-carousel
react-spring-carousel copied to clipboard
getCurrentActiveItem is always the first item
Never seems to change.
Did you manage to work around this @aequasi ?
I did not
@aequasi Hi and sorry for the delay! useSpringCarousel doesn't leverage on react state updates, so in order to use getCurrentActiveItem you need to use it inside the useListenToCustomEvent
@aequasi Hi and sorry for the delay!
useSpringCarouseldoesn't leverage on react state updates, so in order to usegetCurrentActiveItemyou need to use it inside theuseListenToCustomEvent
Hi! I'm experiencing a similar problem, even though i use it according to your instruction:
useListenToCustomEvent((event) => {
if (event.eventName === "onSlideChange") {
let newIndex = event;
console.log(util.inspect(newIndex, false, null))
}
});
Each time i slide through carousel, I get this kind of console.log:
{ eventName: 'onSlideChange',
slideActionType: 'next',
currentItem: { index: -1, id: '' } }
CurrentItem never seems to change