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 thumb index in change handlers #212

Closed
axelboc opened this issue Feb 26, 2021 · 0 comments · Fixed by #225
Closed

Expose thumb index in change handlers #212

axelboc opened this issue Feb 26, 2021 · 0 comments · Fixed by #225

Comments

@axelboc
Copy link

axelboc commented Feb 26, 2021

I'm using a slider with two thumbs and using it as a controlled component with value and onChange. It would be quite helpful if I had an easy way of knowing which thumb has moved in my onChange and onAfterChange event handlers (and onBeforeChange as well, why not):

onChange={(value, index) => { ... }}

In most cases, a workaround is to do an equality check for each value, of course, but if the initial values are not multiples of step, they get rounded, which makes things a bit more challenging.

danielgek added a commit to danielgek/react-slider that referenced this issue Jun 2, 2021
danielgek added a commit to danielgek/react-slider that referenced this issue Jun 2, 2021
danielgek added a commit to danielgek/react-slider that referenced this issue Jun 3, 2021
stonebk pushed a commit that referenced this issue Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants