Make React Spring respect animation preferences (#35018)

This commit is contained in:
Echo 2025-06-11 18:51:55 +02:00 committed by GitHub
commit 3aed93711c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 14 additions and 30 deletions

View file

@ -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;