Skip to content

Commit

Permalink
chore: add TypeScript type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofcelba committed Nov 18, 2017
1 parent 8e34686 commit 9e40f3a
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions index.d.ts
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;

0 comments on commit 9e40f3a

Please sign in to comment.