Fix progress bar regression throughout the app (#9219)
* Fix useSmoothAnimation enablement not working properly by getting rid of it Passing duration=0 is more logical and less superfluous * Refactor UploadBar to handle state more correctly * Change ProgressBar to new useSmoothAnimation signature and default animated to true for consistency * Add type guard * Make types stricter * Write tests for the ProgressBar component * Make the new test conform to tsc --strict * Update UploadBar.tsx * Update UploadBar.tsx * Update UploadBar.tsx
This commit is contained in:
parent
6407cd4c0d
commit
9b99c967f4
5 changed files with 105 additions and 37 deletions
|
@ -25,10 +25,10 @@ interface IProps {
|
|||
}
|
||||
|
||||
const PROGRESS_BAR_ANIMATION_DURATION = 300;
|
||||
const ProgressBar: React.FC<IProps> = ({ value, max, animated }) => {
|
||||
const ProgressBar: React.FC<IProps> = ({ value, max, animated = true }) => {
|
||||
// Animating progress bars via CSS transition isn’t possible in all of our supported browsers yet.
|
||||
// As workaround, we’re using animations through JS requestAnimationFrame
|
||||
const currentValue = useSmoothAnimation(0, value, PROGRESS_BAR_ANIMATION_DURATION, animated);
|
||||
const currentValue = useSmoothAnimation(0, value, animated ? PROGRESS_BAR_ANIMATION_DURATION : 0);
|
||||
return <progress className="mx_ProgressBar" max={max} value={currentValue} />;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue