Skip to content

Web: step snapping ignores minimumValue #840

Open

Description

@RaphaelFakhri
  • Platform: web (react-native-web)
  • @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:

const valueAfterStep = step
  ? Math.round(newValue / step) * step
  : newValue;

iOS uses minimumValue + round((value - minimumValue) / step) * step (package/ios/RNCSlider.m).

Reproducible demo

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

  1. added
    v6Issues that are either resolved by, or checked against the v6 release
    platform: WebIssue relates to react-native for web
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: WebIssue relates to react-native for webv6Issues that are either resolved by, or checked against the v6 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions