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
which version of react & react-native are you using?
Description
The val inside the onSlidingComplete is updated when using tap in Android.
But using val in useState setSliderBrightness does not change the SliderBrightness value.
Reproducible Demo
const [SliderBrightness, setSliderBrightness] = useState(valueItem);
<Slider
style={styles.SliderMargin}
step={1}
disabled={!isEnabled} //If Glowing is activated, the Slider could not be changed.
tapToSeek={true}
minimumTrackTintColor="#307ecc"
maximumTrackTintColor="#000000"
maximumValue={100}
minimumValue={0}
value={SliderBrightness} //Updates on real time. Excellent.
onSlidingComplete={val => {
val => setSliderBrightness(val);
console.log('OnSlidingComplete: ', SliderBrightness);
ChangeBrightnessHappened = true;
//setSliderBrightness(val);
Gibo_Fetch('IGBT=' + val + '&Angga=' + ESPSerialNum);
// navigation.setParams({valueItem: SliderBrightness});
}}
onValueChange={val => setSliderBrightness(val)}
/>
The text was updated successfully, but these errors were encountered:
Hi Team,
I was able to get a solution on my issue. Since I couldn't make the useState work inside the "OnFinishSliding", I just created my own function or callback and pass the val, as such FuncSlider(val).
In the callback function I was able to update my variable SliderBrightness by equaling it to val, so that when I return back to home page I have the correct val data.
This val parameter is not in the documentation. I just found out about it somewhere in an example by chance. It would be nice to have it in documentation.
Environment
Android has issue.
iOS it works.
are you using the new architecture?
which version of react & react-native are you using?
Description
The
val
inside theonSlidingComplete
is updated when using tap in Android.But using val in useState setSliderBrightness does not change the SliderBrightness value.
Reproducible Demo
The text was updated successfully, but these errors were encountered: