From eca331937e841944f44ba22c9ccdc4312dfeec4f Mon Sep 17 00:00:00 2001 From: Gustavo Gard Date: Mon, 23 Oct 2017 11:26:35 -0700 Subject: [PATCH] "subject" field for Share Summary: Add field `subject` to `Options` when Share. Check https://github.com/facebook/react-native/blob/9ee815f6b52e0c2417c04e5a05e1e31df26daed2/Libraries/ActionSheetIOS/ActionSheetIOS.js#L52 iOS: The field `subject` is obtained from `Options` https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/Libraries/ActionSheetIOS/RCTActionSheetManager.m#L159 **iOS:** Tested the following components `ActionSheetIOS` and `Share` using RNTester **Android** Don't use the key `subject` Check https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/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 --- Libraries/Share/Share.js | 14 ++++++++++---- RNTester/js/ShareExample.js | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Libraries/Share/Share.js b/Libraries/Share/Share.js index c34e72ff8..457cf4a96 100644 --- a/Libraries/Share/Share.js +++ b/Libraries/Share/Share.js @@ -22,7 +22,12 @@ const { } = require('NativeModules'); type Content = { title?: string, message: string } | { title?: string, url: string }; -type Options = { dialogTitle?: string, excludedActivityTypes?: Array, tintColor?: string }; +type Options = { + dialogTitle?: string, + excludedActivityTypes?: Array, + tintColor?: string, + subject?: string +}; class Share { @@ -50,12 +55,13 @@ class Share { * * #### iOS * - * - `excludedActivityTypes` - * - `tintColor` + * - `subject` - a subject to share via email + * - `excludedActivityTypes` + * - `tintColor` * * #### Android * - * - `dialogTitle` + * - `dialogTitle` * */ static share(content: Content, options: Options = {}): Promise { diff --git a/RNTester/js/ShareExample.js b/RNTester/js/ShareExample.js index 79f1d0478..9b4d05342 100644 --- a/RNTester/js/ShareExample.js +++ b/RNTester/js/ShareExample.js @@ -82,6 +82,7 @@ class ShareMessageExample extends React.Component<$FlowFixMeProps, any> { url: 'http://facebook.github.io/react-native/', title: 'React Native' }, { + subject: 'A subject to go in the email heading', dialogTitle: 'Share React Native website', excludedActivityTypes: [ 'com.apple.UIKit.activity.PostToTwitter'