fix: add `useReducedMotion` compatibility for Safari 13 and older
Why
Currently, calling useReducedMotion on a Safari browser older than v14 causes an error, crashing the app.
This pull request adds compatibility checks, so that useReducedMotion can be called on older devices without producing an error.
Resolves https://github.com/pmndrs/react-spring/issues/2299
What
Adds truthy checks to MediaQueryList.addEventListener before attempting to call the function. This function is undefined on older browsers.
Checklist
- [x] Ready to be merged
🦋 Changeset detected
Latest commit: 5fd17bb0bf43de43066fb78d0a98f3b60fbc67f6
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 11 packages
| Name | Type |
|---|---|
| @react-spring/shared | Patch |
| @react-spring/animated | Patch |
| @react-spring/core | Patch |
| @react-spring/parallax | Patch |
| @react-spring/rafz | Patch |
| @react-spring/types | Patch |
| @react-spring/konva | Patch |
| @react-spring/native | Patch |
| @react-spring/three | Patch |
| @react-spring/web | Patch |
| @react-spring/zdog | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| react-spring | ✅ Ready (Inspect) | Visit Preview | Jul 8, 2024 11:59pm |
Can you please add a changeset to the PR? 😊 otherwise looks great to me, thanks for the fix!
@joshuaellis Thank you for taking a look at this so quickly! Just added the changeset