-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The value of the progress bar is not refreshing. #60
Comments
Can you please follow the example and give it a try? export const Example = () => {
const progress = useSharedValue(30);
const min = useSharedValue(0);
const max = useSharedValue(100);
return (
<Slider
style={styles.container}
progress={progress}
minimumValue={min}
maximumValue={max}
/>
);
}; |
Are you saying that you have already dragged the thumb, but the slider did not change at all? |
When I manually drag the progress bar, that works fine. The problem is when I get the data from the server and then go to set the progress value, the progress value changes but the progress bar UI does not refresh, it stays at the initial value it was set to. |
maybe this will help you :) export const Example = () => {
const progress = useSharedValue(30);
const min = useSharedValue(0);
const max = useSharedValue(100);
return (
<Slider
style={styles.container}
progress={progress}
minimumValue={min}
maximumValue={max}
cache={progress}
/>
);
}; |
Hi,I made the modifications as you instructed, but the UI of progress still has not refreshed. |
@caner219 Any luck with this? |
I am facing the same issue.... anyone found the solution? |
@caner219, doesn't it work for you if you set the |
I had a similar issue when trying to use the Slider inside a modal. I couldn't get the progress spot to change based on parameters passed into the modal. I think it has something to do with useSharedValue variables updating asynchronously. Here is a link to the documentation (the first code block under remarks is where the problem comes from I think), https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/ |
Having the same problem here, you can just repro the issue with a button setting the sharedValue in progress. It does not update the slider. |
Can confirm the bug occurs when snapToStep is set to true |
Had this same problem. In the meantime, an easy fix is to force the whole component to re-render if you are setting the progress from somewhere else. Easiest way to do that is change the key. So const progress = useSharedValue(0);
useEffect(()=>{
progress.value = outsideValue;
}, [outsideValue]);
...
<Slider
key={`slider-${outsideValue}`}
steps={stepsSV}
/> The key can be whatever but just making a new key forces a full unmount/remount instead of the managed internal state not picking up the new |
When setting the value of progress for the first time, it takes effect. However, when I retrieve data from the server and want to display it on the progress bar, the progress does not refresh. How can I solve this issue?
The text was updated successfully, but these errors were encountered: