Possible to have smooth animation on progress bar?
See original GitHub issueIs there a way to make the animation between progress changes to be smoother? It’s very choppy. I’ve tried slowing down the interval of the animation, but it falls behind. I’m using a custom hook courtesy of Dan Abramov to make sure that the timer is counting down correctly. I’m counting down by 1 second (1000 milliseconds), So I’m not sure how this could be fixed or if it’s on my end.
useInterval.js
import { useEffect, useRef } from 'react';
export default (callback, delay) => {
const savedCallback = useRef();
// Remember the latest callback.
useEffect(() => {
savedCallback.current = callback;
}, [callback]);
// Set up the interval.
useEffect(() => {
function tick() {
savedCallback.current();
}
if (delay !== null) {
const id = setInterval(tick, delay);
return () => clearInterval(id);
}
}, [delay]);
};
useInterval(() => {
if (time > 0) setTime(prevState => prevState - 1);
else endTime();
}, 1000);
<ProgressBar
progress={time / timer} //time and timer is some number out of a total, i.e. 10/25
width={RFPercentage(40)}
height={RFPercentage(1)}
borderRadius={20}
useNativeDriver
animationType='spring'
color={theme.accent}
/>
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Smooth Progress Bar Animation - android
To correct this you have a few options. The first is to up your integers from 0 to someBigInt This will give the...
Read more >Android : Smooth Progress Bar Animation - YouTube
Android : Smooth Progress Bar Animation [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Android : Smooth Progress Bar ...
Read more >How to Create a Smooth Animated Progress Bar
While working on a timer component I needed a smooth animated progress bar so came up with the following. It only has a...
Read more >How to Make an Animated Progress Bar in CSS
The text of the button needs to be inline-block as we will make positional transitions on it. You also need to set transition...
Read more >Smooth Progress Bar Animation
Smooth Progress Bar Animation ... Material Design offers two visually distinct types of progress indicators: linear and circular progress indicators. Only one ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We noticed a huge js performance issue when we rerender
Circle
to animate progress.<Progress.Circle progress={dymanicNumber}/>
So we had to replace it to animated react-native-svg with useNativeDriver.No, I implemented my own. It was not difficult actually, using
Animated.timing
you should get what you need in a hour or so.