You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the HoC wrapper to determine when a carousel reaches the end of it's total slides, then reversing the playDirection via the setStoreState method - however despite reflecting in the props that the value has been changed to backward - the carousel still continues to play in the forward direction.
If I manually input an event such as a click on NextButton, PrevButton or a Dot the carousel then reflects the change. What's strange is properties such as isPlaying or currentSlide reflect immediately but for some reason playDirection does not.
Some example code.
class NavigationControl extends React.Component {
componentDidUpdate() {
if (this.props.currentSlide === 5) {
this.props.carouselStore.setStoreState({ playDirection: "backward" });
}
}
render() {
// render stuff here
}
}
export default WithStore(NavigationControl, state => ({
currentSlide: state.currentSlide,
playDirection: state.playDirection,
totalSlides: state.totalSlides
}));
My NavigationControl component is within the CarouselProvider as shown within the documentation.
Any ideas?
If I am approaching this the wrong way or there is a simpler solution then I would be very grateful for the guidance 😄
Thanks,
Paul
The text was updated successfully, but these errors were encountered:
Hey there,
I'm trying to use the HoC wrapper to determine when a carousel reaches the end of it's total slides, then reversing the playDirection via the setStoreState method - however despite reflecting in the props that the value has been changed to
backward
- the carousel still continues to play in theforward
direction.If I manually input an event such as a click on NextButton, PrevButton or a Dot the carousel then reflects the change. What's strange is properties such as
isPlaying
orcurrentSlide
reflect immediately but for some reasonplayDirection
does not.Some example code.
My NavigationControl component is within the CarouselProvider as shown within the documentation.
Any ideas?
If I am approaching this the wrong way or there is a simpler solution then I would be very grateful for the guidance 😄
Thanks,
Paul
The text was updated successfully, but these errors were encountered: