-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Part of #24875 ## Changelog [General] [Added] - Add TurboModule spec for AlertManager Pull Request resolved: #24906 Reviewed By: lunaleaps Differential Revision: D15471065 Pulled By: fkgozali fbshipit-source-id: bb22e6454b1f748987f3a8cd957bfd4e027493a5
- Loading branch information
1 parent
9560776
commit 122cc8b
Showing
3 changed files
with
72 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* 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 | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {TurboModule} from 'RCTExport'; | ||
import * as TurboModuleRegistry from 'TurboModuleRegistry'; | ||
|
||
export type Buttons = Array<{ | ||
text?: string, | ||
onPress?: ?Function, | ||
style?: AlertButtonStyle, | ||
}>; | ||
|
||
export type Options = { | ||
cancelable?: ?boolean, | ||
onDismiss?: ?() => void, | ||
}; | ||
|
||
/* 'default' | plain-text' | 'secure-text' | 'login-password' */ | ||
export type AlertType = string; | ||
|
||
/* 'default' | 'cancel' | 'destructive' */ | ||
export type AlertButtonStyle = string; | ||
|
||
export type Args = {| | ||
title?: string, | ||
message?: string, | ||
buttons?: Buttons, | ||
type?: string, | ||
defaultValue?: string, | ||
cancelButtonKey?: string, | ||
destructiveButtonKey?: string, | ||
keyboardType?: string, | ||
|}; | ||
|
||
export interface Spec extends TurboModule { | ||
+alertWithArgs: ( | ||
args: Args, | ||
callback: (id: number, value: string) => void, | ||
) => void; | ||
} | ||
|
||
export default TurboModuleRegistry.get<Spec>('AlertManager'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters