Emiliano-Bucci / react-spring-carousel-js

A new Carousel experience for the modern Web
https://react-spring-carousel-js.emilianobucci.com
80 stars 6 forks source link

`onSlideStartChange` event fires for all rendered carousels #7

Closed tmcgann closed 3 years ago

tmcgann commented 3 years ago

Situation: I have two custom carousel components that render on the same page. The components are completely independent and execute useSpringCarousel separately. The second carousel further down the page leverages useListenToCustomEvent to track when the onSlideStartChange event fires so that it can change some state in its component.

Problem: When I use slideToPrevItem or slideToNextItem in the first component, it causes onSlideStartChange to fire in the second component. I assume the event fires for any/all carousels. However, I did NOT expect this. I would expect the events to only fire for the respective components, NOT all components.

Emiliano-Bucci commented 3 years ago

@tmcgann Hi, thanks for the feedback! You're right, events should be only triggered for the respective carousel and not for all of them. My bad; when you can, please update to the latest version - 1.9.1 - issue should be fixed now. Let me know :)

tmcgann commented 3 years ago

@Emiliano-Bucci All fixed up in 1.9.5! Thanks! Keep up the great work!