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

Proposal to add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo #452

Closed
gabrieldonadel opened this issue Jan 27, 2022 · 3 comments

Comments

@gabrieldonadel
Copy link
Member

Introduction

I would like to propose adding support for "Prefer Cross-Fade Transitions" into AccessibilityInfo by exposing the iOS UIAccessibilityPrefersCrossFadeTransitions() function.

Details

UIAccessibilityPrefersCrossFadeTransitions was added to UIKit on iOS 14.0 indicating whether the Reduce Motion and the Prefer Cross-Fade Transitions settings are in an enabled state. It would be great to have a method for that embedded into AccessibilityInfo. As this is an iOS-only feature I suggest we just always return false on Android.

There's a caveat though, we would not be able to add support for a prefersCrossFadeTransitionsChanged event into AccessibilityInfo.addEventListener because from my testing (iOS 14.4 and 15.2) UIAccessibilityPrefersCrossFadeTransitionsStatusDidChangeNotification does not get triggered when changing the "Prefer Cross-Fade Transitions" option in the accessibility settings, due to this factor we would need to call UIAccessibilityPrefersCrossFadeTransitions() every time to get the most updated value instead of storing it into a private variable inside RCTAccessibilityManager

My idea is to add a prefersCrossFadeTransitions function to AccessibilityInfo which would probably look something like this:

  prefersCrossFadeTransitions(): Promise<boolean> {
    return new Promise((resolve, reject) => {
      if (Platform.OS === 'android') {
        return Promise.resolve(false);
      } else {
        if (NativeAccessibilityManagerIOS != null) {
          NativeAccessibilityManagerIOS.getCurrentPrefersCrossFadeTransitionsState(
            resolve,
            reject,
          );
        } else {
          reject(null);
        }
      }
    });
  }

Note: I already have a draft for this implementation if anyone is interested in taking a look gabrieldonadel/react-native#2

Discussion points

  • Should we add a prefersCrossFadeTransitions function to AccessibilityInfo?
@gabrieldonadel
Copy link
Member Author

gabrieldonadel commented Jan 31, 2022

I believe this would be especially helpful for solving facebook/react-native#31484

@martsie
Copy link

martsie commented Feb 14, 2022

This would help improve react-navigation for users who have motion sensitivity and prefer cross-fade transitions

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Aug 25, 2022
…ityInfo (#34406)

Summary:
This PR adds `prefersCrossFadeTransitions()` to AccessibilityInfo in order to add support for "Prefer Cross-Fade Transitions", exposing the iOS settings option as proposed here react-native-community/discussions-and-proposals#452.
I believe this would be especially helpful for solving #31484

#### TODO
- [ ]  Submit react-native-web PR updating AccessibilityInfo documentation.

## Changelog

[iOS] [Added] - Add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo

Pull Request resolved: #34406

Test Plan:
**On iOS 14+**

1.  Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions".
2. Open the RNTester app and navigate to the Accessibility page

https://user-images.githubusercontent.com/11707729/154588402-7d050858-3c2d-4d86-9585-928b8c66941b.mov

Reviewed By: cipolleschi

Differential Revision: D38711316

Pulled By: makovkastar

fbshipit-source-id: b9965cd4285f1aa0f1fa927080370a22329c2f62
@gabrieldonadel
Copy link
Member Author

I'm closing this as the support for "Prefer Cross-Fade Transitions" into AccessibilityInfo was added through facebook/react-native@be7c50f

kelset pushed a commit to facebook/react-native that referenced this issue Oct 3, 2022
…ityInfo (#34406)

Summary:
This PR adds `prefersCrossFadeTransitions()` to AccessibilityInfo in order to add support for "Prefer Cross-Fade Transitions", exposing the iOS settings option as proposed here react-native-community/discussions-and-proposals#452.
I believe this would be especially helpful for solving #31484

#### TODO
- [ ]  Submit react-native-web PR updating AccessibilityInfo documentation.

## Changelog

[iOS] [Added] - Add support for "Prefer Cross-Fade Transitions" into AccessibilityInfo

Pull Request resolved: #34406

Test Plan:
**On iOS 14+**

1.  Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions".
2. Open the RNTester app and navigate to the Accessibility page

https://user-images.githubusercontent.com/11707729/154588402-7d050858-3c2d-4d86-9585-928b8c66941b.mov

Reviewed By: cipolleschi

Differential Revision: D38711316

Pulled By: makovkastar

fbshipit-source-id: b9965cd4285f1aa0f1fa927080370a22329c2f62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants