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

Fix: ignored step value during dragging #393

Merged
merged 3 commits into from
Jun 30, 2022
Merged

Conversation

BartoszKlonowski
Copy link
Member

This pull request fixes #390
It allows to successfully use the step property which is considered during dragging and during programmatically control of the Slider.

The root cause of this issue was that the controlled value property modified the dragging logic changing the way the value is passed to RNCSlider instance according to sliding start and progress.
Due to that the value was given the unclipped value (uncalculated) during dragging which was assigned to the thumb only, but at the finish of the dragging the value of the whole component received the calculated one.
This resulted in observed smooth thumb transition, while value having the values respecting the step property.

The implementation of the fix moves the calculation of the discrete value which calculates the value according to the given step (if no step is given, the transition remains smooth).
The internal discreteValue calculation is utilized in both Slider Manager and Slider instance itself.

The results of the fix are presented below:

390-repro-fix.mov

@BartoszKlonowski BartoszKlonowski added the platform: iOS Issue related to iOS platform label Jun 28, 2022
@BartoszKlonowski BartoszKlonowski merged commit 76b4db1 into main Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: iOS Issue related to iOS platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thumb does not move discretely with step prop set
1 participant