Files
react-native/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js
T
Ramanpreet Nara 3a6327a5d9 Open source react-native-modules ESLint rule
Summary:
Open source this ESLint rule so that we can lint our open source NativeModule specs.

Changelog: [Internal]

Reviewed By: shergin, cpojer

Differential Revision: D23791748

fbshipit-source-id: e44444bc87eaa9dc9b7f2b3ed03151798a35e8a5
2020-09-22 11:32:37 -07:00

51 lines
1.3 KiB
JavaScript

/**
* 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.
*
* @flow strict
* @format
*/
'use strict';
import type {TurboModule} from '../../TurboModule/RCTExport';
import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';
/* 'buttonClicked' | 'dismissed' */
type DialogAction = string;
/*
buttonPositive = -1,
buttonNegative = -2,
buttonNeutral = -3
*/
type DialogButtonKey = number;
export type DialogOptions = {|
title?: string,
message?: string,
buttonPositive?: string,
buttonNegative?: string,
buttonNeutral?: string,
items?: Array<string>,
cancelable?: boolean,
|};
export interface Spec extends TurboModule {
+getConstants: () => {|
+buttonClicked: DialogAction,
+dismissed: DialogAction,
+buttonPositive: DialogButtonKey,
+buttonNegative: DialogButtonKey,
+buttonNeutral: DialogButtonKey,
|};
+showAlert: (
// eslint-disable-next-line @react-native/codegen/react-native-modules
config: DialogOptions,
onError: (error: string) => void,
onAction: (action: DialogAction, buttonKey?: DialogButtonKey) => void,
) => void;
}
export default (TurboModuleRegistry.get<Spec>('DialogManagerAndroid'): ?Spec);