You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@react-native-community/slider: 5.2.1 (also current main)
Description
On web, the slider rounds the touched value to the nearest multiple of step counted from 0, not from minimumValue. If minimumValue is not a multiple of step, the reported values fall outside the step grid.
With minimumValue={1}, maximumValue={10} and step={2}:
Expected values: 1, 3, 5, 7, 9 (as on iOS and Android).
Actual values from the web component: multiples of 2 (plus 1 and 10 at the track ends). Releasing a quarter of the way along the track reports 4 instead of 3.
The cause is in getValueFromNativeEvent in package/src/RNCSliderNativeComponent.web.tsx:
Render the web component with minimumValue={1}, maximumValue={10} and step={2} in a Jest test with @testing-library/react-native, fire responderRelease with pageX at a quarter of the track width, and read the value passed to onRNCSliderSlidingComplete: it is 4, not 3.
Activity