Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReducedMotionConfig component #6164

Merged
merged 16 commits into from
Jul 15, 2024
Merged

Conversation

piaskowyk
Copy link
Member

Summary

This PR adds ReduceMotionConfig component that allows to determine the default animation behavior in response to the device's reduced motion accessibility setting. It affects application globally. The default behavior disables all animation if reduced motion is enabled on a device. You can utilize this component to override that behavior.

Usage

function App() {
  
  return (
    // ...
    <ReduceMotionConfig mode={ReduceMotion.Never} />
    // ...
  );
}

Demo

Screen.Recording.2024-06-24.at.18.25.37.mov

Test plan

Open Reduce Motion example from example app.

Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of overriding it this simply!

Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it lacks some logic

@szydlovsky szydlovsky self-requested a review June 27, 2024 15:00
Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it's fine 👍

@szydlovsky szydlovsky self-requested a review June 27, 2024 16:08
Copy link
Contributor

@szydlovsky szydlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the refactor - just please tak a look at linter

Copy link
Member

@kacperkapusciak kacperkapusciak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@piaskowyk piaskowyk changed the title Add ReduceMotionConfig component Add ReducedMotionConfig component Jul 15, 2024
@piaskowyk piaskowyk added this pull request to the merge queue Jul 15, 2024
Merged via the queue into main with commit 7194196 Jul 15, 2024
6 checks passed
@piaskowyk piaskowyk deleted the @piaskowyk/reducemotionconfig branch July 15, 2024 10:55
@diegolmello
Copy link

Awesome. Thanks for working on this important topic ❤️

@vyobukhov
Copy link

Hi guys,

do we really need this annoying warning on every app init in dev mode?

console.warn(
      `[Reanimated] Reduced motion setting is overwritten with mode '${mode}'.`
    );

If it was overwritten, it was done on purpose, so what is the point to remind about it on every app reload in dev?

@piaskowyk
Copy link
Member Author

piaskowyk commented Aug 12, 2024

To avoid confusion, if any library that you depend on call it in their code. If you want to silence this warning, just use:

import { LogBox } from 'react-native';
LogBox.ignoreLogs(['[Reanimated] Reduced motion']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants