Skip to content

Commit

Permalink
Allow reverting the skipanimation
Browse files Browse the repository at this point in the history
  • Loading branch information
JCQuintas committed Aug 26, 2024
1 parent c5ceca5 commit c2101de
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/x-charts/src/hooks/useReducedMotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useIsomorphicLayoutEffect, Globals } from '@react-spring/web';
const handleMediaChange = (e: { matches: boolean | undefined }) => {
Globals.assign({
// Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
skipAnimation: e.matches || undefined,
skipAnimation: e.matches,
});
};

Expand All @@ -19,8 +19,6 @@ export const useReducedMotion = () => {

useIsomorphicLayoutEffect(() => {
const shouldSkipAnimation =
// Skip animation in SSR
typeof window === 'undefined' ||
// Skip animation test/jsdom
!window?.matchMedia;

Expand Down

0 comments on commit c2101de

Please # to comment.