Skip to content

Commit

Permalink
Fix rounding in Slider component
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

There was a typo in condition. We need to be comparing step prop and not value. The same condition is implemented in Paper.

Reviewed By: JoshuaGross

Differential Revision: D23903493

fbshipit-source-id: 37506d0fac63f624332041602489ab1cf378bfcc
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Sep 24, 2020
1 parent 77c1657 commit 371430d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ - (void)onChange:(UISlider *)sender withContinuous:(BOOL)continuous

const auto &props = *std::static_pointer_cast<const SliderProps>(_props);

if (props.step > 0 && value <= (props.maximumValue - props.minimumValue)) {
if (props.step > 0 && props.step <= (props.maximumValue - props.minimumValue)) {
value = MAX(
props.minimumValue,
MIN(props.maximumValue, props.minimumValue + round((value - props.minimumValue) / props.step) * props.step));
Expand Down

0 comments on commit 371430d

Please sign in to comment.