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 useReducedMotion hook #4687

Merged
merged 7 commits into from
Jul 11, 2023

Conversation

bartlomiejbloniarz
Copy link
Contributor

@bartlomiejbloniarz bartlomiejbloniarz commented Jul 7, 2023

Summary

Animations can cause some people to feel unwell. In order to help developers create apps with those people in mind this PR adds a useReducedMotion hook that returns a boolean value informing whether the "Reduced Motion" setting was enabled when the app started.

Screen.Recording.2023-07-10.at.11.32.28.mov

Test plan

Test the behavior of ReducedMotionExample on android, iOS and Web.

src/reanimated2/hook/Hooks.ts Outdated Show resolved Hide resolved
src/reanimated2/hook/Hooks.ts Outdated Show resolved Hide resolved
src/reanimated2/hook/Hooks.ts Outdated Show resolved Hide resolved
src/reanimated2/hook/Hooks.ts Outdated Show resolved Hide resolved
Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

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

Looks good to me ✅

@hubertdej
Copy link

Cool feature! 😍

Copy link
Member

@piaskowyk piaskowyk left a comment

Choose a reason for hiding this comment

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

👏

@bartlomiejbloniarz bartlomiejbloniarz added this pull request to the merge queue Jul 11, 2023
Merged via the queue into main with commit 56674b3 Jul 11, 2023
@bartlomiejbloniarz bartlomiejbloniarz deleted the @bartlomiejbloniarz/add-useReducedMotion branch July 11, 2023 08:03
Latropos pushed a commit that referenced this pull request Jul 11, 2023
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

Animations can cause some people to feel unwell. In order to help
developers create apps with those people in mind this PR adds a
`useReducedMotion` hook that returns a boolean value informing whether
the "Reduced Motion" setting was enabled when the app started.


https://github.com/software-mansion/react-native-reanimated/assets/56109050/6ffa6e06-2a29-499b-8119-409c943050dd

## Test plan
Test the behavior of ReducedMotionExample on android, iOS and Web.
Latropos pushed a commit that referenced this pull request Jul 13, 2023
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

Animations can cause some people to feel unwell. In order to help
developers create apps with those people in mind this PR adds a
`useReducedMotion` hook that returns a boolean value informing whether
the "Reduced Motion" setting was enabled when the app started.

https://github.com/software-mansion/react-native-reanimated/assets/56109050/6ffa6e06-2a29-499b-8119-409c943050dd

Test the behavior of ReducedMotionExample on android, iOS and Web.
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.

5 participants