Permalink
Browse files

"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 #15800

Differential Revision: D6060998

Pulled By: hramos

fbshipit-source-id: fd06f680a4705989e397c5700d8ab35aa7129ba6
  • Loading branch information...
gusgard authored and facebook-github-bot committed Oct 23, 2017
1 parent d38b95f commit eca331937e841944f44ba22c9ccdc4312dfeec4f
Showing with 11 additions and 4 deletions.
  1. +10 −4 Libraries/Share/Share.js
  2. +1 −0 RNTester/js/ShareExample.js
View
@@ -22,7 +22,12 @@ const {
} = require('NativeModules');
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

This comment has been minimized.

Show comment
Hide comment
@chirag04

chirag04 Oct 23, 2017

Collaborator

@gusgard @janicduplessis I feel like this should go into content. This works because we are spreading options and content right now but ideally it should be in the content.

On android: { title, message }
On ios: { subject, message, url }

@chirag04

chirag04 Oct 23, 2017

Collaborator

@gusgard @janicduplessis I feel like this should go into content. This works because we are spreading options and content right now but ideally it should be in the content.

On android: { title, message }
On ios: { subject, message, url }

This comment has been minimized.

Show comment
Hide comment
@WaldoJeffers
@WaldoJeffers
};
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<Object> {
@@ -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'

0 comments on commit eca3319

Please sign in to comment.