Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getCurrentActiveItem is always the first item #15

Open
cryptiklemur opened this issue Oct 1, 2022 · 4 comments
Open

getCurrentActiveItem is always the first item #15

cryptiklemur opened this issue Oct 1, 2022 · 4 comments

Comments

@cryptiklemur
Copy link

Never seems to change.

@nathanbirrell
Copy link

Did you manage to work around this @aequasi ?

@cryptiklemur
Copy link
Author

I did not

@Emiliano-Bucci
Copy link
Owner

@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

@Raiden0456
Copy link

Raiden0456 commented May 22, 2023

@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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants