callstack / callstack/react-theme-provider

Preferred light/dark theme?

未关闭
#55 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
467
派生
53
PR 合并指标
30 天内没有已合并 PR

描述

## Describe the feature

It'd be nice to automatically be able to accommodate a user's preferred light/dark theme preferences.

Perhaps, simplifying the check of `uiMode && UI_MODE_NIGHT_MASK` [on Android](https://developer.android.com/reference/android/content/res/Configuration.html#uiMode) and `traitCollection.userInterfaceStyle` [on iOS](https://developer.apple.com/documentation/uikit/uiuserinterfacestyle).

These both have `undefined`/`unspecified`, `light`, and `dark`/`night`.

Unfortunately, the [built-in react-native uiMode](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java#L47) doesn't give this information.

## Motivation

With iOS 13 and Android Q making this sort of theming more integrated (and Google and Apple's own apps supporting the ability to switch at the OS level), it'd be nice to automatically detect what theme the user wants.

I'd rather not force a user to fumble through app settings to configure the theme if they've already got an option to specify it at the OS level.

## Related Issues

I didn't see any at first glance, but I may have missed them.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。