"subject" field for Share

Summary:
Add field `subject` to `Options` when Share.
Check 9ee815f6b5/Libraries/ActionSheetIOS/ActionSheetIOS.js (L52)

iOS:
The field `subject` is obtained from `Options`
1e8f3b1102/Libraries/ActionSheetIOS/RCTActionSheetManager.m (L159)

**iOS:**
Tested the following components `ActionSheetIOS` and `Share` using RNTester

**Android**
Don't use the key `subject`
Check 1e8f3b1102/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java (L52)
Closes https://github.com/facebook/react-native/pull/15800

Differential Revision: D6060998

Pulled By: hramos

fbshipit-source-id: fd06f680a4705989e397c5700d8ab35aa7129ba6
This commit is contained in:
Gustavo Gard 2017-10-23 11:26:35 -07:00 committed by Facebook Github Bot
parent d38b95f8b7
commit eca331937e
2 changed files with 11 additions and 4 deletions

View File

@ -22,7 +22,12 @@ const {
} = require('NativeModules'); } = require('NativeModules');
type Content = { title?: string, message: string } | { title?: string, url: string }; type Content = { title?: string, message: string } | { title?: string, url: string };
type Options = { dialogTitle?: string, excludedActivityTypes?: Array<string>, tintColor?: string }; type Options = {
dialogTitle?: string,
excludedActivityTypes?: Array<string>,
tintColor?: string,
subject?: string
};
class Share { class Share {
@ -50,12 +55,13 @@ class Share {
* *
* #### iOS * #### iOS
* *
* - `excludedActivityTypes` * - `subject` - a subject to share via email
* - `tintColor` * - `excludedActivityTypes`
* - `tintColor`
* *
* #### Android * #### Android
* *
* - `dialogTitle` * - `dialogTitle`
* *
*/ */
static share(content: Content, options: Options = {}): Promise<Object> { static share(content: Content, options: Options = {}): Promise<Object> {

View File

@ -82,6 +82,7 @@ class ShareMessageExample extends React.Component<$FlowFixMeProps, any> {
url: 'http://facebook.github.io/react-native/', url: 'http://facebook.github.io/react-native/',
title: 'React Native' title: 'React Native'
}, { }, {
subject: 'A subject to go in the email heading',
dialogTitle: 'Share React Native website', dialogTitle: 'Share React Native website',
excludedActivityTypes: [ excludedActivityTypes: [
'com.apple.UIKit.activity.PostToTwitter' 'com.apple.UIKit.activity.PostToTwitter'