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

fix: add `useReducedMotion` compatibility for Safari 13 and older

Open BenHodgsonR2R opened this issue 1 year ago • 4 comments

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

BenHodgsonR2R avatar Jul 01 '24 07:07 BenHodgsonR2R

🦋 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

changeset-bot[bot] avatar Jul 01 '24 07:07 changeset-bot[bot]

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

vercel[bot] avatar Jul 01 '24 07:07 vercel[bot]

Can you please add a changeset to the PR? 😊 otherwise looks great to me, thanks for the fix!

joshuaellis avatar Jul 01 '24 10:07 joshuaellis

@joshuaellis Thank you for taking a look at this so quickly! Just added the changeset

BenHodgsonR2R avatar Jul 01 '24 10:07 BenHodgsonR2R