Skip to content

API for user preferences #350

@grgr-dkrk

Description

@grgr-dkrk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions