Make React Spring respect animation preferences (#35018)
This commit is contained in:
parent
f53bb4cd7d
commit
3aed93711c
8 changed files with 14 additions and 30 deletions
|
|
@ -4,7 +4,6 @@ import { animated, useSpring } from '@react-spring/web';
|
|||
|
||||
import UploadFileIcon from '@/material-icons/400-24px/upload_file.svg?react';
|
||||
import { Icon } from 'mastodon/components/icon';
|
||||
import { reduceMotion } from 'mastodon/initial_state';
|
||||
|
||||
interface UploadProgressProps {
|
||||
active: boolean;
|
||||
|
|
@ -20,7 +19,7 @@ export const UploadProgress: React.FC<UploadProgressProps> = ({
|
|||
const styles = useSpring({
|
||||
from: { width: '0%' },
|
||||
to: { width: `${progress}%` },
|
||||
immediate: reduceMotion || !active, // If this is not active, update the UI immediately.
|
||||
immediate: !active, // If this is not active, update the UI immediately.
|
||||
});
|
||||
if (!active) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue