mirror of
https://github.com/status-im/react-native.git
synced 2025-01-22 07:20:23 +00:00
99 lines
1.3 KiB
Markdown
99 lines
1.3 KiB
Markdown
|
---
|
||
|
id: share
|
||
|
title: Share
|
||
|
layout: docs
|
||
|
category: APIs
|
||
|
permalink: docs/share.html
|
||
|
next: statusbarios
|
||
|
previous: settings
|
||
|
---
|
||
|
|
||
|
|
||
|
|
||
|
### Methods
|
||
|
|
||
|
- [`share`](docs/share.html#share)
|
||
|
- [`sharedAction`](docs/share.html#sharedaction)
|
||
|
- [`dismissedAction`](docs/share.html#dismissedaction)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
---
|
||
|
|
||
|
# Reference
|
||
|
|
||
|
## Methods
|
||
|
|
||
|
### `share()`
|
||
|
|
||
|
```javascript
|
||
|
static share(content, options)
|
||
|
```
|
||
|
|
||
|
|
||
|
Open a dialog to share text content.
|
||
|
|
||
|
In iOS, Returns a Promise which will be invoked an object containing `action`, `activityType`.
|
||
|
If the user dismissed the dialog, the Promise will still be resolved with action being `Share.dismissedAction`
|
||
|
and all the other keys being undefined.
|
||
|
|
||
|
In Android, Returns a Promise which always be resolved with action being `Share.sharedAction`.
|
||
|
|
||
|
### Content
|
||
|
|
||
|
- `message` - a message to share
|
||
|
- `title` - title of the message
|
||
|
|
||
|
#### iOS
|
||
|
|
||
|
- `url` - an URL to share
|
||
|
|
||
|
At least one of URL and message is required.
|
||
|
|
||
|
### Options
|
||
|
|
||
|
#### iOS
|
||
|
|
||
|
- `subject` - a subject to share via email
|
||
|
- `excludedActivityTypes`
|
||
|
- `tintColor`
|
||
|
|
||
|
#### Android
|
||
|
|
||
|
- `dialogTitle`
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
---
|
||
|
|
||
|
### `sharedAction()`
|
||
|
|
||
|
```javascript
|
||
|
static sharedAction()
|
||
|
```
|
||
|
|
||
|
|
||
|
The content was successfully shared.
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
---
|
||
|
|
||
|
### `dismissedAction()`
|
||
|
|
||
|
```javascript
|
||
|
static dismissedAction()
|
||
|
```
|
||
|
|
||
|
|
||
|
The dialog has been dismissed.
|
||
|
@platform ios
|
||
|
|
||
|
|
||
|
|
||
|
|