AlertIOS provides functionality to create an iOS alert dialog with a
message or create a prompt for user input.
Creating an iOS alert:
Creating an iOS prompt:
We recommend using the Alert.alert method for
cross-platform support if you don't need to create iOS-only prompts.
Create and display a popup alert.
| Name and Type | Description | 
|---|---|
| title string  | The dialog's title.  | 
| [message] string  | An optional message that appears below the dialog's title.  | 
| [callbackOrButtons] ?(() => void) | ButtonsArray  | This optional argument should be either a single-argument function or an array of buttons. If passed a function, it will be called when the user taps 'OK'.    If passed an array of button configurations, each button should include
   a   | 
| [type] | Deprecated, do not use.  | 
Create and display a prompt to enter some text.
| Name and Type | Description | 
|---|---|
| title string  | The dialog's title.  | 
| [message] string  | An optional message that appears above the text input.  | 
| [callbackOrButtons] ?((text: string) => void) | ButtonsArray  | This optional argument should be either a single-argument function or an array of buttons. If passed a function, it will be called with the prompt's value when the user taps 'OK'.    If passed an array of button configurations, each button should include
   a   | 
| [type] | This configures the text input. One of 'plain-text', 'secure-text' or 'login-password'.  | 
| [defaultValue] string  | The default text in text input.  | 
An Alert button type
| Value | Description | 
|---|---|
| default | Default alert with no inputs  | 
| plain-text | Plain text input alert  | 
| secure-text | Secure text input alert  | 
| login-password | Login and password alert  | 
An Alert button style
| Value | Description | 
|---|---|
| default | Default button style  | 
| cancel | Cancel button style  | 
| destructive | Destructive button style  | 
Array or buttons
| Name and Type | Description | 
|---|---|
| [text] string  | Button label  | 
| [onPress] function  | Callback function when button pressed  | 
| [style] | Button style  | 
You can edit the content above on GitHub and send us a pull request!
Examples # | Edit on GitHub |