NativeAppearance.js 988 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @flow strict-local
  8. * @format
  9. */
  10. 'use strict';
  11. import type {TurboModule} from '../TurboModule/RCTExport';
  12. import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
  13. export type ColorSchemeName = 'light' | 'dark';
  14. export type AppearancePreferences = {|
  15. // TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
  16. // types.
  17. /* 'light' | 'dark' */
  18. colorScheme?: ?string,
  19. |};
  20. export interface Spec extends TurboModule {
  21. // TODO: (hramos) T52919652 Use ?ColorSchemeName once codegen supports union
  22. // types.
  23. /* 'light' | 'dark' */
  24. +getColorScheme: () => ?string;
  25. // RCTEventEmitter
  26. +addListener: (eventName: string) => void;
  27. +removeListeners: (count: number) => void;
  28. }
  29. export default (TurboModuleRegistry.get<Spec>('Appearance'): ?Spec);