Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/ios/RNCSliderManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ - (void)tapHandler:(UITapGestureRecognizer *)gesture {
}

static float discreteValue(RNCSlider *sender, float value) {
// Check if thumb should reach the maximum value and put it on the end of track if yes.
// To avoid affecting the thumb when on maximum, the `step >= (value - maximum)` is not checked.
if (sender.step > 0 && value >= sender.maximumValue) {
return sender.maximumValue;
}

// If step is set and less than or equal to difference between max and min values,
// pick the closest discrete multiple of step to return.

if (sender.step > 0 && sender.step <= (sender.maximumValue - sender.minimumValue)) {

// Round up when increase, round down when decrease.
Expand Down