mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
b355ba56db
Summary: This diff fixes the flow errors that surfaced from flow-typing DialogManagerAndorid and deleting NativeDialogManagerAndroid. I also migrated all imports of NativeDialogManagerAndorid to import the module from `react-native-implementation.js`. Reviewed By: fkgozali Differential Revision: D15440162 fbshipit-source-id: 2fdfb68104bc8ffb93c0c77fe15aacadc182f62f
50 lines
1.2 KiB
JavaScript
50 lines
1.2 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-local
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import type {TurboModule} from 'RCTExport';
|
|
import * as TurboModuleRegistry from 'TurboModuleRegistry';
|
|
|
|
/* 'buttonClicked' | 'dismissed' */
|
|
type DialogAction = string;
|
|
/*
|
|
buttonPositive = -1,
|
|
buttonNegative = -2,
|
|
buttonNeutral = -3
|
|
*/
|
|
type DialogButtonKey = number;
|
|
export type DialogOptions = {|
|
|
title?: string,
|
|
message?: Stringish,
|
|
buttonPositive?: Stringish,
|
|
buttonNegative?: Stringish,
|
|
buttonNeutral?: Stringish,
|
|
items?: Array<string>,
|
|
cancelable?: boolean,
|
|
|};
|
|
|
|
export interface Spec extends TurboModule {
|
|
+getConstants: () => {|
|
|
+buttonClicked: DialogAction,
|
|
+dismissed: DialogAction,
|
|
+buttonPositive: DialogButtonKey,
|
|
+buttonNegative: DialogButtonKey,
|
|
+buttonNeutral: DialogButtonKey,
|
|
|};
|
|
+showAlert: (
|
|
config: DialogOptions,
|
|
onError: (string) => void,
|
|
onAction: (action: DialogAction, buttonKey?: DialogButtonKey) => void,
|
|
) => void;
|
|
}
|
|
|
|
export default TurboModuleRegistry.get<Spec>('DialogManagerAndroid');
|