mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Added Subject to ActionSheetIOS share options and updated example
Summary: I've added a subject property to the ActionSheetIOS.showShareActionSheetWithOptions options object. This will allow users to set a subject for things like emails when they are sharing to them through the ActionSheetIOS.
Options are now as follows:
```
{
url: 'https://code.facebook.com',
message: 'message to go with the shared url',
subject: 'a subject to go in the email heading',
}
```
Closes https://github.com/facebook/react-native/pull/4238
Reviewed By: svcscm
Differential Revision: D2674536
Pulled By: nicklockwood
fb-gh-sync-id: 3dfad39f94f19999233bf777253ef71b6e692a6d
This commit is contained in:
committed by
facebook-github-bot-6
parent
3e7db56445
commit
0bf7928ebe
@@ -88,6 +88,8 @@ var ShareActionSheetExample = React.createClass({
|
||||
showShareActionSheet() {
|
||||
ActionSheetIOS.showShareActionSheetWithOptions({
|
||||
url: 'https://code.facebook.com',
|
||||
message: 'message to go with the shared url',
|
||||
subject: 'a subject to go in the email heading',
|
||||
},
|
||||
(error) => {
|
||||
console.error(error);
|
||||
|
||||
@@ -166,6 +166,12 @@ RCT_EXPORT_METHOD(showShareActionSheetWithOptions:(NSDictionary *)options
|
||||
}
|
||||
|
||||
UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
|
||||
|
||||
NSString *subject = [RCTConvert NSString:options[@"subject"]];
|
||||
if (subject) {
|
||||
[shareController setValue:subject forKey:@"subject"];
|
||||
}
|
||||
|
||||
UIViewController *controller = RCTKeyWindow().rootViewController;
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0
|
||||
|
||||
Reference in New Issue
Block a user