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
{{ message }}
Repository navigation
iOS: negative min value and 0 as maximum value turns maximum to 1 #780
When creating a slider with minimumValue = -10 and maximumValue = 0, the application in android works as expected, but on iOS the maximumValue gets overwritten to 1.
I traced this on current main, and the issue is specific to the Fabric prop-update boundary rather than RNCSlider.setMaximumValue itself.
Slider.tsx correctly forwards an explicit maximumValue={0}. However, RNCSliderNativeComponent.ts declares maximumValue?: Double, so the generated RNCSliderProps default is 0. RNCSliderComponentView initializes _props from those default props, while UIKit's UISlider starts with maximumValue == 1. On the first update for an explicit zero, oldScreenProps.maximumValue and newScreenProps.maximumValue are both 0, so the equality guard skips [slider setMaximumValue:0] and UIKit keeps 1. A negative minimum does differ from the generated default, so it is applied, producing exactly the reported -10...1 range. Android does not use this UIKit/default-props mismatch.
There are two narrow fixes:
make the codegen contract match the public API default (maximumValue?: WithDefault<Double, 1>, with the other numeric defaults made explicit as appropriate), or
have updateProps compare slider.maximumValue with newScreenProps.maximumValue so an initial native/default mismatch is corrected.
I prefer the first because it aligns generated defaults across platforms and keeps old/new-prop diffing valid. The repository currently has JS tests but no native iOS unit-test target; a JS renderer test would pass before the fix because the zero is already forwarded correctly. Would maintainers prefer a codegen-schema regression for option 1, or an iOS fixture/manual regression for option 2? Once the expected test surface is confirmed, I can send the focused fix without adding a test that proves only the JS half.
Activity
huytdps13400 commentedon Aug 26, 2026
I traced this on current
main, and the issue is specific to the Fabric prop-update boundary rather thanRNCSlider.setMaximumValueitself.Slider.tsxcorrectly forwards an explicitmaximumValue={0}. However,RNCSliderNativeComponent.tsdeclaresmaximumValue?: Double, so the generatedRNCSliderPropsdefault is0.RNCSliderComponentViewinitializes_propsfrom those default props, while UIKit'sUISliderstarts withmaximumValue == 1. On the first update for an explicit zero,oldScreenProps.maximumValueandnewScreenProps.maximumValueare both0, so the equality guard skips[slider setMaximumValue:0]and UIKit keeps1. A negative minimum does differ from the generated default, so it is applied, producing exactly the reported-10...1range. Android does not use this UIKit/default-props mismatch.There are two narrow fixes:
maximumValue?: WithDefault<Double, 1>, with the other numeric defaults made explicit as appropriate), orupdatePropscompareslider.maximumValuewithnewScreenProps.maximumValueso an initial native/default mismatch is corrected.I prefer the first because it aligns generated defaults across platforms and keeps old/new-prop diffing valid. The repository currently has JS tests but no native iOS unit-test target; a JS renderer test would pass before the fix because the zero is already forwarded correctly. Would maintainers prefer a codegen-schema regression for option 1, or an iOS fixture/manual regression for option 2? Once the expected test surface is confirmed, I can send the focused fix without adding a test that proves only the JS half.