Fixes story viewing for reduced motion users
This commit is contained in:
parent
0be580e8e5
commit
89b5768775
1 changed files with 18 additions and 1 deletions
|
@ -10,7 +10,7 @@ import React, {
|
|||
useState,
|
||||
} from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { useSpring, animated, to } from '@react-spring/web';
|
||||
import { Globals, useSpring, animated, to } from '@react-spring/web';
|
||||
import type { BodyRangeType, LocalizerType } from '../types/Util';
|
||||
import type { ContextMenuOptionType } from './ContextMenu';
|
||||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
|
@ -234,6 +234,23 @@ export const StoryViewer = ({
|
|||
};
|
||||
}, []);
|
||||
|
||||
// Currently there's no way to globally skip animations but only allow select
|
||||
// ones. This component temporarily overrides the skipAnimation global and
|
||||
// then sets it back when it unmounts.
|
||||
// https://github.com/pmndrs/react-spring/issues/1982
|
||||
useEffect(() => {
|
||||
const { skipAnimation } = Globals;
|
||||
Globals.assign({
|
||||
skipAnimation: false,
|
||||
});
|
||||
|
||||
return () => {
|
||||
Globals.assign({
|
||||
skipAnimation,
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
const [styles, spring] = useSpring(
|
||||
() => ({
|
||||
from: { width: 0 },
|
||||
|
|
Loading…
Add table
Reference in a new issue