Files
react-native/Libraries
Birkir Gudjonsson 0a4dcb0309 Add Appearance.setColorScheme support (#35989)
Summary:
Both Android and iOS allow you to set application specific user interface style, which is useful for applications that support both light and dark mode.

With the newly added `Appearance.setColorScheme`, you can natively manage the application's user interface style rather than keeping that preference in JavaScript. The benefit is that native dialogs like alert, keyboard, action sheets and more will also be affected by this change.

Implemented using Android X [AppCompatDelegate.setDefaultNightMode](https://developer.android.com/reference/androidx/appcompat/app/AppCompatDelegate#setDefaultNightMode(int)) and iOS 13+ [overrideUserInterfaceStyle](https://developer.apple.com/documentation/uikit/uiview/3238086-overrideuserinterfacestyle?language=objc)

## Changelog

[GENERAL] [ADDED] - Added `setColorScheme` to `Appearance` module

Pull Request resolved: https://github.com/facebook/react-native/pull/35989

Test Plan:
This is a void function so testing is rather limited.

```tsx
// Lets assume a given device is set to **dark** mode.

Appearance.getColorScheme(); // `dark`

// Set the app's user interface to `light`
Appearance.setColorScheme('light');

Appearance.getColorScheme(); // `light`

// Set the app's user interface to `unspecified`
Appearance.setColorScheme(null);

Appearance.getColorScheme() // `dark`
 ```

Reviewed By: NickGerleman

Differential Revision: D42801094

Pulled By: jacdebug

fbshipit-source-id: ede810fe9ee98f313fd3fbbb16b60c84ef8c7204
2023-02-07 06:23:39 -08:00
..
2022-09-30 14:28:48 -07:00
2023-01-03 18:09:06 -08:00
2023-01-23 07:38:48 -08:00
2022-09-30 14:28:48 -07:00
2023-01-23 07:38:48 -08:00
2022-09-30 14:28:48 -07:00
2022-09-30 14:28:48 -07:00
2023-01-18 08:21:49 -08:00
2022-09-30 14:28:48 -07:00
2023-01-03 18:09:06 -08:00
2023-01-03 18:09:06 -08:00
2022-09-30 14:28:48 -07:00
2022-12-06 19:34:14 -08:00
2023-01-03 18:09:06 -08:00
2022-11-02 14:58:37 -07:00
2023-01-03 18:09:06 -08:00
2023-01-19 14:04:23 -08:00