react-native-macos/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
..
ActionSheetIOS ESM processColor 2023-01-03 18:09:06 -08:00
Alert Adding AlertOptions to ts Alert.prompt function (#35957) 2023-01-25 02:14:45 -08:00
Animated Upgrade to Flow 0.198.1 2023-01-23 07:38:48 -08:00
AppDelegate feat: add initialProps property to RCTAppDelegate (#35848) 2023-01-18 06:42:39 -08:00
AppState RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
BatchedBridge Upgrade to Flow 0.198.1 2023-01-23 07:38:48 -08:00
Blob Restore Dynamic framework with Hermes in the Old Architecture 2023-01-30 04:25:26 -08:00
BugReporting Codemod cycle annotations for xplat/js 2022-11-01 17:13:27 -07:00
Components feat: Add logical border block color properties (#35999) 2023-01-31 10:58:24 -08:00
Core setUpPerformance not to redirect to WebPerformance before the API is public (#35901) 2023-01-19 10:08:32 -08:00
DevToolsSettings Add iOS + Android support for getting/setting reload-and-profile-related settings 2022-12-05 22:07:30 -08:00
EventEmitter RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Events remove return type from constructor (#35466) 2022-11-24 18:26:36 -08:00
FBLazyVector Remove fb_apple_library export from rn_defs 2022-11-17 09:56:30 -08:00
HeapCapture RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Image remove unused type imports 1/1 2023-01-18 08:21:49 -08:00
Inspector Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
Interaction Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
JSInspector RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
LayoutAnimation RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Linking Do not use InteractionManager to wait for Activity (#35289) 2022-11-14 03:38:52 -08:00
LinkingIOS Update .podspec license information (#35245) 2022-11-07 09:52:52 -08:00
Lists Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
LogBox ESM LogBox 2023-01-03 18:09:06 -08:00
Modal Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
NativeAnimation Support colors for AnimatedInterpolation on iOS 2022-12-05 08:24:54 -08:00
NativeComponent feat: Add logical border radius implementation (#35572) 2023-01-06 06:00:03 -08:00
NativeModules/specs Scaffolding for the PerformanceObserver TurboModule (C++ side) (#35226) 2022-11-08 10:01:21 -08:00
Network ESM RCTNetworking 2023-01-03 18:09:06 -08:00
NewAppScreen RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Performance Exclude PerformanceObserver from flow/haste 2022-11-03 07:14:41 -07:00
PermissionsAndroid Rename `POST_NOTIFICATION` to `POST_NOTIFICATIONS` (#35533) 2022-12-09 12:56:07 -08:00
Pressability Expose setLongPressDeactivationDistance as class method 2022-12-09 12:58:02 -08:00
PushNotificationIOS Add missing types to PushNotificationIOS 2022-12-15 09:54:03 -08:00
RCTRequired fix missing imports and set disable_infer_precompiled_header] 2022-12-04 13:30:16 -08:00
ReactNative react-native | remove unused internal feature flag 2023-01-23 10:37:36 -08:00
ReactPrivate Enable LTI in react-native 2022-12-06 19:34:14 -08:00
Reliability Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Renderer React Native sync for revisions 17f6912...48b687f 2023-01-31 09:17:55 -08:00
Settings Update .podspec license information (#35245) 2022-11-07 09:52:52 -08:00
Share ESM processColor 2023-01-03 18:09:06 -08:00
StyleSheet Add `borderCurve` and `pointerEvents` to `ViewStyle` (#35998) 2023-02-01 12:20:40 -08:00
SurfaceBackedComponent Remove clang-format opt-out for Libraries 2022-10-13 02:23:13 -07:00
SurfaceHostingComponent Remove clang-format opt-out for Libraries 2022-10-13 02:23:13 -07:00
Text Add a nil check to prevent a crash (#35941) 2023-01-24 03:57:45 -08:00
TurboModule Fix TurboModuleRegistry TS type (#35885) 2023-01-19 05:56:51 -08:00
TypeSafety chore: RCTConvert - allocate array with capacity (#35490) 2022-11-28 07:29:04 -08:00
Types Fixup TS Organization (#35169) 2022-11-02 14:58:37 -07:00
Utilities Add Appearance.setColorScheme support (#35989) 2023-02-07 06:23:39 -08:00
Vibration Fix Vibration.vibrate() allowing null params 2022-12-14 15:23:12 -08:00
WebPerformance Use a more robust method of finding out which events to report 2023-01-04 08:57:40 -08:00
WebSocket Log Abnormal Closes to Metro Websocket 2022-10-26 20:09:32 -07:00
Wrapper Remove clang-format opt-out for Libraries 2022-10-13 02:23:13 -07:00
YellowBox ESM LogBox 2023-01-03 18:09:06 -08:00
__flowtests__ RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
vendor refactor(react-native/polyfills): rename package to @react-native/js-polyfills and align version 2022-12-05 18:34:33 -08:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Remove nonstandard Promise.prototype.done implementation 2022-05-05 03:55:10 -07:00
UTFSequence.js Add newline to UTFSequence 2023-01-19 14:04:23 -08:00
promiseRejectionTrackingOptions.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00