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

Expose active group index #46

Open
NerdCowboy opened this issue Oct 15, 2019 · 1 comment
Open

Expose active group index #46

NerdCowboy opened this issue Oct 15, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request hacktoberfest This issue is suitable for the hacktoberfest ;)

Comments

@NerdCowboy
Copy link

NerdCowboy commented Oct 15, 2019

I'm building something similar to https://virtuoso.dev/scroll-to-group/

I'd like to trigger some functionality whenever a new group index becomes active to do things like add an active class to the navigational buttons, but I can't seem to find anything that exposes the current active group index.

Am I missing something? Otherwise, I think it would be best to expose it in the scrollingStateChange or in itemsRendered

@NerdCowboy
Copy link
Author

I did find a workaround by doing the following in itemsRendered callback, but would still be nice to have this exposed natively:

const itemsRenderCallback = items => {
    const renderedGroupIndices = items.map(item => item.groupIndex)
    setActiveGroupIndex(Math.min(...renderedGroupIndices))
  }

@petyosi petyosi self-assigned this Oct 17, 2019
@petyosi petyosi added the enhancement New feature or request label Oct 17, 2019
@petyosi petyosi added the hacktoberfest This issue is suitable for the hacktoberfest ;) label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest This issue is suitable for the hacktoberfest ;)
Projects
None yet
Development

No branches or pull requests

2 participants