-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Slider] removed react-draggable dependency (fixes IE!) #1825
Conversation
Fixes #1745 - see #1745 (comment). |
@yongxu, @shaurya947, @KapJI can you please take a look here. I saw you are the last contributors to the Slider component, so maybe you can make a quick review. |
I reviewed this PR and tested it locally on the latest Chrome, Safari and Firefox on OS X 10.11. Now handle and cursor don't diverge. Seems good to me. Good job, @igorbt! |
let value = this._alignValue(this._percentToValue(percent)); | ||
if (this.props.onChange) this.props.onChange(e, value); | ||
this.setPercent(percent, () => { | ||
if (this.props.onChange) this.props.onChange(e, this.state.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will call onChange many times with same value during dragging. I think it will be better to call onChange only when value changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @KapJI for review and for this finding. You are right and I just fixed it, but from setPercent, it seemed more convenient there for me.
@yongxu, thanks for review!
|
@yongxu comparing percent difference with step is not a good idea, because step is measured in absolute value, not in percent. |
so avoiding unnecessary re-rendering and unnecessary calling of onChange from _updateWithChangeEvent.
@yongxu you are right, just removed that line. |
@shaurya947 can you please also have a look and merge this PR? |
React 0.14 support
so avoiding unnecessary re-rendering and unnecessary calling of onChange from _updateWithChangeEvent.
…to slider-fix Conflicts: src/slider.jsx
@shaurya947, I just rebased. Can you please also have a look and merge this PR? That's a pain to keep rebasing given the change rate in the library. |
[Slider] removed react-draggable dependency (fixes IE!)
There you go, thanks @igorbt |
Awsome! Thanks @shaurya947! I think at least 5 bugs shoul be closed now. |
Fixing this bug #708, I ended up that it's better to entirely remove react-draggable dependency. With this change I saw also it seems to be more responsive.
Also, this fixes desynchronization between the mouse position and slider handle.
A (very) little breaking change in the onDragStop and onDragStart APIs - it no longer provides second argument - ui. I think it was useless anyway because it had handle offset in pixels. I cannot think about a scenario when someone really need this. I you don't agree, I can try to add it back by calculating it.