mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
63fa3f21c5
Summary: Implements the Appearance native module as discussed in https://github.com/react-native-community/discussions-and-proposals/issues/126. The purpose of the Appearance native module is to expose the user's appearance preferences. It provides a basic get() API that returns the user's preferred color scheme on iOS 13 devices, also known as Dark Mode. It also provides the ability to subscribe to events whenever an appearance preference changes. The name, "Appearance", was chosen purposefully to allow for future expansion to cover other appearance preferences such as reduced motion, reduced transparency, or high contrast modes. Changelog: [iOS] [Added] - The Appearance native module can be used to prepare your app for Dark Mode on iOS 13. Reviewed By: yungsters Differential Revision: D16699954 fbshipit-source-id: 03b4cc5d2a1a69f31f3a6d9bece23f6867b774ea
38 lines
966 B
Plaintext
38 lines
966 B
Plaintext
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @generated by an internal plugin build system
|
|
*/
|
|
|
|
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER
|
|
|
|
// OSS-compatibility layer
|
|
|
|
#import "CoreModulesPlugins.h"
|
|
|
|
#import <string>
|
|
#import <unordered_map>
|
|
|
|
static std::unordered_map<std::string, Class (*)(void)> sCoreModuleClassMap = {
|
|
{"AccessibilityManager", RCTAccessibilityManagerCls},
|
|
{"Appearance", RCTAppearanceCls},
|
|
{"DeviceInfo", RCTDeviceInfoCls},
|
|
{"ExceptionsManager", RCTExceptionsManagerCls},
|
|
{"ImageLoader", RCTImageLoaderCls},
|
|
{"PlatformConstants", RCTPlatformCls},
|
|
};
|
|
|
|
Class RCTCoreModulesClassProvider(const char *name) {
|
|
auto p = sCoreModuleClassMap.find(name);
|
|
if (p != sCoreModuleClassMap.end()) {
|
|
auto classFunc = p->second;
|
|
return classFunc();
|
|
}
|
|
return nil;
|
|
}
|
|
|
|
#endif // RN_DISABLE_OSS_PLUGIN_HEADER
|