-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add TypeScript type definitions
- Loading branch information
1 parent
8e34686
commit 9e40f3a
Showing
1 changed file
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Type definitions for react-native-prompt-android 0.3.1 | ||
// Project: https://github.com/shimohq/react-native-prompt-android | ||
// Definitions by: Krystof Celba <https://github.com/krystofcelba> | ||
// TypeScript Version: 2.6.1 | ||
|
||
type PromptButton = { | ||
text?: string; | ||
onPress?: (message: string) => void; | ||
|
||
/** @platform ios */ | ||
style?: 'default' | 'cancel' | 'destructive'; | ||
}; | ||
|
||
type PromptType = 'default' | 'plain-text' | 'secure-text'; | ||
type PromptTypeIOS = 'login-password'; | ||
type PromptTypeAndroid = 'numeric' | 'email-address' | 'phone-pad'; | ||
|
||
type PromptStyleAndroid = 'default' | 'shimo'; | ||
|
||
export interface PromptOptions { | ||
/** | ||
* * Cross platform: | ||
* | ||
* - `'default'` | ||
* - `'plain-text'` | ||
* - `'secure-text'` | ||
* | ||
* * iOS only: | ||
* | ||
* - `'login-password'` | ||
* | ||
* * Android only: | ||
* | ||
* - `'numeric'` | ||
* - `'email-address'` | ||
* - `'phone-pad'` | ||
*/ | ||
type?: PromptType | PromptTypeIOS | PromptTypeAndroid; | ||
|
||
defaultValue?: string; | ||
|
||
/** @platform android */ | ||
placeholder?: string; | ||
|
||
/** @platform android */ | ||
cancelable?: boolean; | ||
|
||
/** @platform android */ | ||
style?: PromptStyleAndroid; | ||
} | ||
|
||
declare function prompt( | ||
title?: string, | ||
message?: string, | ||
callbackOrButtons?: ((value: string) => void) | Array<PromptButton>, | ||
options?: PromptOptions, | ||
): void; | ||
|
||
export default prompt; |