2017-11-08 00:34:50 +00:00
---
id: actionsheetios
title: ActionSheetIOS
layout: docs
category: APIs
permalink: docs/actionsheetios.html
next: alert
previous: accessibilityinfo
---
2017-11-09 17:47:50 +00:00
Display action sheets and share sheets on iOS.
2017-11-08 00:34:50 +00:00
### Methods
- [`showActionSheetWithOptions` ](docs/actionsheetios.html#showactionsheetwithoptions )
- [`showShareActionSheetWithOptions` ](docs/actionsheetios.html#showshareactionsheetwithoptions )
---
# Reference
## Methods
### `showActionSheetWithOptions()`
```javascript
2017-11-09 17:47:50 +00:00
ActionSheetIOS.showActionSheetWithOptions(options, callback)
2017-11-08 00:34:50 +00:00
```
2017-11-20 21:07:10 +00:00
Display an iOS action sheet.
2017-11-08 00:34:50 +00:00
2017-11-20 21:07:10 +00:00
| Name | Type | Required | Description |
| - | - | - | - |
| options | object | Yes | See below. |
| callback | function | Yes | Provides index for the selected item. |
The `options` object must contain one or more of:
2017-11-08 00:34:50 +00:00
- `options` (array of strings) - a list of button titles (required)
- `cancelButtonIndex` (int) - index of cancel button in `options`
- `destructiveButtonIndex` (int) - index of destructive button in `options`
- `title` (string) - a title to show above the action sheet
- `message` (string) - a message to show below the title
The 'callback' function takes one parameter, the zero-based index
of the selected item.
Minimal example:
```
ActionSheetIOS.showActionSheetWithOptions({
options: ['Remove', 'Cancel'],
destructiveButtonIndex: 1,
cancelButtonIndex: 0,
},
(buttonIndex) => {
if (buttonIndex === 1) { // destructive action }
});
```
---
### `showShareActionSheetWithOptions()`
```javascript
2017-11-09 17:47:50 +00:00
ActionSheetIOS.showShareActionSheetWithOptions(options, failureCallback, successCallback)
2017-11-08 00:34:50 +00:00
```
2017-11-20 21:07:10 +00:00
Display the iOS share sheet.
2017-11-08 00:34:50 +00:00
2017-11-20 21:07:10 +00:00
| Name | Type | Required | Description |
| - | - | - | - |
| options | object | Yes | See below. |
| failureCallback | function | Yes | See below. |
| successCallback | function | Yes | See below. |
The `options` object should contain one or both of `message` and `url` and can additionally have a `subject` or `excludedActivityTypes` :
2017-11-08 00:34:50 +00:00
- `url` (string) - a URL to share
- `message` (string) - a message to share
- `subject` (string) - a subject for the message
- `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet
2017-11-20 21:07:10 +00:00
> NOTE:
> If `url` points to a local file, or is a base64-encoded uri, the file it points to will be loaded and shared directly. In this way, you can share images, videos, PDF files, etc.
2017-11-08 00:34:50 +00:00
2017-11-20 21:07:10 +00:00
The 'failureCallback' function takes one parameter, an error object. The only property defined on this object is an optional `stack` property of type `string` .
2017-11-08 00:34:50 +00:00
The 'successCallback' function takes two parameters:
- a boolean value signifying success or failure
- a string that, in the case of success, indicates the method of sharing