Skip to content

Commit

Permalink
fix: matchMedia is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Aug 19, 2021
1 parent d208114 commit 46cc577
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const prefersReducedMotion = (() => {
let shouldReduceMotion: boolean | undefined = undefined;

return () => {
if (shouldReduceMotion === undefined) {
if (shouldReduceMotion === undefined && typeof window !== "undefined") {
const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)');
shouldReduceMotion = !mediaQuery || mediaQuery.matches;
}
Expand Down

0 comments on commit 46cc577

Please sign in to comment.