-
Notifications
You must be signed in to change notification settings - Fork 574
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 to be be responsive to click #92
base: master
Are you sure you want to change the base?
Conversation
thanks a lot :) |
Hey guys! Is there something needed to do here? I really want this option 😃 |
just wait for the merge :) @eyalcohen4 |
@eyalcohen4 @UI-Animation-Chen Thanks, guys. As of now, I am pointing to my fork's release to make things work for me. You can try out the same if it's very urgent for you but I strongly recommend to revert to this once merged. |
thanks 👍 |
@jeanregisser any chance this could be merged and released soon? I'd really love to have this feature |
src/Slider.js
Outdated
_handlePanResponderGrant = (/*e: Object, gestureState: Object*/) => { | ||
this._previousLeft = this._getThumbLeft(this._getCurrentValue()); | ||
_handlePanResponderGrant = (e: Object, gestureState: Object) => { | ||
this._previousLeft = this.props.trackClickable ? gestureState.x0 - (this.state.thumbSize.width/2) : this._getThumbLeft(this._getCurrentValue()); |
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.
gestureState.x0
is relative to the root component, this should be e.nativeEvent.locationX
which is relative to the panResponder component.
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.
also need to change:
this.state.thumbSize -> this.props.thumbTouchSize
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.
Hope it to be merged too :) |
So... |
make Slider responsive to clicks
src/Slider.js
Outdated
@@ -315,7 +322,7 @@ export default class Slider extends PureComponent { | |||
|
|||
_handlePanResponderGrant = (e: Object, gestureState: Object) => { | |||
// this._previousLeft = this._getThumbLeft(this._getCurrentValue()); | |||
this._previousLeft = gestureState.x0 - (this.state.thumbSize.width/2); |
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.
react-native-slider is still not clickable
Does anyone have a solution for this?
I made the above changes to the Slider.js file. It still does not work for Android or IOS.
Slider.txt
7cbd788
to
48c3395
Compare
Half a year has passed, and there is still no merger. Do you have any questions about this? |
any progress with the PR? |
Could this be merged to master please? |
Hi @jeanregisser
I was using the Slider as a seek bar for a video player and required to make it clickable. I have included this as a prop called trackClickable, (sorry, I am bad with var naming conventions) so that the changes don't break anything.