You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 oruseWindowDimensions
hooks.Discussion points
According to https://reactnative.dev/docs/appearance,
The Appearance API is inspired by the Media Queries draft from the W3C
, butprefers-
is not a query for dark mode. This is one of the queries to get preferences.Properties such as
inverted-colors
andprefers-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
.The text was updated successfully, but these errors were encountered: