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

API for user preferences #350

Open
grgr-dkrk opened this issue May 18, 2021 · 0 comments
Open

API for user preferences #350

grgr-dkrk opened this issue May 18, 2021 · 0 comments

Comments

@grgr-dkrk
Copy link

Introduction

React Native has APIs to get the settings which users need for their application.
However, the API required to get the settings is different, which is a little complicated. It can be confusing for developers who want to get specific preferences.
It would be nice to be able to get it from a consistent API.

Details

For example, the Appearance API gets the dark mode settings. It also has its own API called DynamicColorIOS.
Then, If the user wants to reduce motion, we need to listen to reduceMotionChanged in AccessibilityInfo API.
In addition, if we want to get to the font scale user-specified, we need to use the getFontScale of PixelRatio API or useWindowDimensions hooks.

Discussion points

According to https://reactnative.dev/docs/appearance, The Appearance API is inspired by the Media Queries draft from the W3C, but prefers- is not a query for dark mode. This is one of the queries to get preferences.
Properties such as inverted-colors and prefers-reduced-motion, also added in CSS Media Queries Level 5, are in the AccessibilityInfo API for React Native.

The worlds of CSS and React Native are different, so I'm not sure if that's right.
However, in the use case of getting user preferences, I think that is desirable to get from the common API, such as Preferences.

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

No branches or pull requests

1 participant