Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Share module #5904

Closed
wants to merge 49 commits into from
Closed

Add Share module #5904

wants to merge 49 commits into from

Conversation

deminoth
Copy link
Contributor

@deminoth deminoth commented Feb 13, 2016

Share

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

  • excludedActivityTypes
  • tintColor

Android

  • dialogTitle

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @andreicoman11, @mkonicek and @nicklockwood to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Feb 13, 2016
Text,
TextInput,
TouchableHighlight,
Share,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

property Share Property not found in Object.create

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add it to the react-native.js.flow file.

@facebook-github-bot
Copy link
Contributor

@deminoth updated the pull request.

@bestander
Copy link
Contributor

FYI BUCK build is failing in circle CI.
Could you edit BUCK file to make it building?

@facebook-github-bot
Copy link
Contributor

@deminoth updated the pull request.

@facebook-github-bot
Copy link
Contributor

@deminoth updated the pull request.

@facebook-github-bot
Copy link
Contributor

@deminoth updated the pull request.

@deminoth
Copy link
Contributor Author

@satya164 @bestander Thanks :)

@facebook-github-bot
Copy link
Contributor

@deminoth updated the pull request.

@facebook-github-bot
Copy link
Contributor

@deminoth updated the pull request.

@satya164
Copy link
Contributor

cc @nicklockwood @dmmiller

@ghost
Copy link

ghost commented Apr 3, 2016

@ericvicenti would you mind taking a look at this pull request? It's been a while since the last commit was reviewed.

@deminoth
Copy link
Contributor Author

deminoth commented Apr 4, 2016

Now I think it's not a good idea making a new module... Maybe this feature should included in the Linking Module?

@satya164
Copy link
Contributor

satya164 commented Apr 4, 2016

Sorry this got neglected. Will review it soon. Why do you think this should be part of linking?

@satya164 satya164 self-assigned this Apr 4, 2016
@deminoth
Copy link
Contributor Author

deminoth commented Apr 4, 2016

@satya164 Nevermind. I thought Linking is interact with outer apps but it's just interact with app links.

throw new JSApplicationIllegalArgumentException("Invalid contents");
}

mPromise = promise;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

}

if (content.hasKey("url")) {
intent.putExtra(Intent.EXTRA_TEXT, content.getString("url")); // this will overwrite message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ignore this prop on Android.

@satya164
Copy link
Contributor

Thanks a lot @deminoth . Overall looks good. Just address the few things I mentioned and we can merge,

@satya164
Copy link
Contributor

Also would be nice to update the PR text with the new API. It'll be useful when someone looks at the commit to see how to use this.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 22, 2016
@satya164
Copy link
Contributor

@facebook-github-bot shipit

@ghost ghost added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Jul 25, 2016
@ghost
Copy link

ghost commented Jul 25, 2016

Thanks for importing. If you are an FB employee go to Phabricator to review internal test results.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 25, 2016
@ghost ghost closed this in 3b35732 Jul 25, 2016
@andreicoman11
Copy link
Contributor

Thanks @deminoth for sticking with this and seeing it through.

rozele pushed a commit to microsoft/react-native-windows that referenced this pull request Jul 26, 2016
Summary:
revision of facebook/react-native#5476

It has only one method `shareTextContent` and next will be`shareBinaryContent`.

In Android, Promise can't receive a result, because `startActivityForResult` is not working with `Intent.ACTION_SEND`. Maybe we can use `createChooser(Intent target, CharSequence title, IntentSender sender)` which requires API level 22.
Closes facebook/react-native#5904

Differential Revision: D3612889

fbshipit-source-id: 0e7aaf34b076a99089cc76bd649e6da067d9a760
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
revision of facebook#5476

It has only one method `shareTextContent` and next will be`shareBinaryContent`.

In Android, Promise can't receive a result, because `startActivityForResult` is not working with `Intent.ACTION_SEND`. Maybe we can use `createChooser(Intent target, CharSequence title, IntentSender sender)` which requires API level 22.
Closes facebook#5904

Differential Revision: D3612889

fbshipit-source-id: 0e7aaf34b076a99089cc76bd649e6da067d9a760
@bucketclan
Copy link

bucketclan commented May 13, 2017

I still face this issue.
RN - 40
react - 15.4.1
iOS - 10.2
device - iPhone 7 Plus(Simulator)

@deminoth
Copy link
Contributor Author

@Themarsguy Can I get some more info?

@IjzerenHein
Copy link
Contributor

Hi, just curious, was there a reason why specifying an URL/image was not implemented on Android? Were there any hurdles with this?
I'm asking, because I was thinking of adding this.
Cheers

@deminoth
Copy link
Contributor Author

@IjzerenHein As I remember, the app chooser didn't support Uri and some extras well at that time. Maybe you can do better with recent Android apis :)

@IjzerenHein
Copy link
Contributor

Alright, thanks for the feedback @deminoth 👍
I've already made the code changes, however I'm having a hard time building react-native from source in order to test the contribution..
Any tips on that? :)

@deminoth
Copy link
Contributor Author

@IjzerenHein Read documents and see https://github.com/facebook/react-native/tree/master/RNTester (was UIExplorer when I wrote this module)

@IjzerenHein
Copy link
Contributor

Alright, thanks for the tip @deminoth !

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.