My use case is that the first time a user changes the slider, I want to show a popup and reset the slider's value back to what it was before. So I use React.useRef to save/update the current value of the slider any time it changes, and then when the value of the slider is updated, I check if the value has changed and try to set it back to the previously recorded value, but what I see is that Slider is using the incorrect value:
Click on the end of the slider in the last (3) position
You should see an alert that writes, "Setting newValue 3"
Click OK and then you should see an alert that writes, "changed from 1 to 3"
Click OK and then you should see an alert that writes, "Setting newValue 3"
As you can see from the code, the last alert is wrong. We know from the second alert that we are calling setSelectedValue(1);, but Slider's onValueChange is called with 3 in correctly.
Expected behavior
Slider should change the value to 1
Screenshots
N/A
Please complete the following information:
OS: Web
Browser: Firefox
@react-native-assets/slider version: latest
Additional context
I skipped the actual logic that handles the popup just the first time as this was enough to demonstrate the problem.
Describe the bug
My use case is that the first time a user changes the slider, I want to show a popup and reset the slider's value back to what it was before. So I use
React.useRef
to save/update the current value of the slider any time it changes, and then when the value of the slider is updated, I check if the value has changed and try to set it back to the previously recorded value, but what I see is thatSlider
is using the incorrect value:To Reproduce
setSelectedValue(1);
, but Slider'sonValueChange
is called with3
in correctly.Expected behavior
Slider should change the value to 1
Screenshots
N/A
Please complete the following information:
Additional context
I skipped the actual logic that handles the popup just the first time as this was enough to demonstrate the problem.