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
Move thumb directly where the user taps #45
Comments
+1 |
2 similar comments
+1 |
+1 |
you can just wrap it with TouchableWithoutFeedback and gets coordinates when user tap.
it works for me |
+1 |
avkvak . 666 |
avkvak's solution works well - hoping you could put it into a PR? |
@avkvak , can you please let me know how it's work, So according to formula (evt.nativeEvent.locationX - px) / width |
@Ashi90 , "px" is a just slider offset from the edge of the screen. |
@avkvak ,Ok "PX" is offset value from the edge of the screen, but what about others, I'm not getting the actual position of touch in slider. |
@fadlykayo because react-native-slider takes its value from 0 (left edge) to 1 (right edge). and yes, sorry for my english) |
@avkvak thank you for the detailed explanation. hope this also could help others. |
@avkvak Thank you for this tip. This works great! Next up is to figure out how the the thumb will continue to be dragged after the user pressed the slider... Any ideas? |
Any progress on this? |
You can do something like this! handelSliderTap = (event) => {
this.refs.sliderWrapper.measure((fx, fy, width, height, px, py) => {
const completedDistance = ((event.nativeEvent.locationX - px) / width) * 100
const completedDuration = (completedDistance * this.state.duration) / 100
...
})
} |
It would be nice if it was built in and after pressing somewhere you could immediately start moving your finger to position slider more precisely |
have look on pull request #164 it will be helpful for you |
here is @avkvak answer but with hooks, works by tapping, but not by tapping and dragging in the same gesture
|
Seems like its not working |
|
Only way to move the thumb is by sliding it. But if the user taps directly in a section of the slider, it won't move directly to that position.
I've seen that behaviour in the youtube app, for example
so far, what a great library!
The text was updated successfully, but these errors were encountered: