react-native-multi-slider
react-native-multi-slider copied to clipboard
Setting the same number does not update the component
- [x] I have searched existing issues
- [x] I am using the latest multi slider version
If you have validation rules in place it may happen that you set the same value as the previous one, but since the UI does not reflect it the component needs to be updated. Unfortunately that doesn't happen and it skips the update.
<MultiSlider
values={[requiredLevel[0], requiredLevel[1]]}
sliderLength={viewWidth * 0.9}
onValuesChangeFinish={([min, max]) => {
let allowedMin = min < userLevel ? min : userLevel;
let allowedMax = max > userLevel ? max : userLevel;
if (allowedMax - allowedMin < 2.5) {
allowedMax = allowedMin + 2.5 < 10 ? allowedMin + 2.5 : 10;
allowedMin = allowedMax - 2.5;
}
setRequiredLevel([allowedMin, allowedMax]);
}}
min={0}
max={10}
step={0.1}
snapped
enableLabel
/>
You can force this by setting a key={random} a regular react feature. That will nuke the component.