NativeAlertManager.js 829 B

12345678910111213141516171819202122232425262728293031323334
  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
  8. * @format
  9. */
  10. 'use strict';
  11. import type {TurboModule} from '../TurboModule/RCTExport';
  12. import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
  13. export type Args = {|
  14. title?: string,
  15. message?: string,
  16. buttons?: Array<Object>, // TODO: have a better type
  17. type?: string,
  18. defaultValue?: string,
  19. cancelButtonKey?: string,
  20. destructiveButtonKey?: string,
  21. keyboardType?: string,
  22. |};
  23. export interface Spec extends TurboModule {
  24. +alertWithArgs: (
  25. args: Args,
  26. callback: (id: number, value: string) => void,
  27. ) => void;
  28. }
  29. export default (TurboModuleRegistry.get<Spec>('AlertManager'): ?Spec);