react-spring icon indicating copy to clipboard operation
react-spring copied to clipboard

[bug]: useReducedMotion: error on Safari < 14

Open BenHodgsonR2R opened this issue 1 year ago • 0 comments

Which react-spring target are you using?

  • [X] @react-spring/web
  • [ ] @react-spring/three
  • [ ] @react-spring/native
  • [ ] @react-spring/konva
  • [ ] @react-spring/zdog

What version of react-spring are you using?

9.7.3

What's Wrong?

The useReducedMotion hook calls MediaQueryList.addEventListener(), this causes an error in older Safari browsers- which are yet to have this function available.

To Reproduce

  • Be on Safari 13.1 or lower
  • Visit this url: https://codesandbox.io/s/eager-gould-hm3rtj?file=/src/App.tsx
  • See the error

Expected Behaviour

Doesn't throw an error and also honours the (prefers-reduced-motion) media query.

Link to repo

https://codesandbox.io/s/eager-gould-hm3rtj?file=/src/App.tsx

BenHodgsonR2R avatar Jul 01 '24 07:07 BenHodgsonR2R