-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Add Share module #5904
Conversation
By analyzing the blame information on this pull request, we identified @andreicoman11, @mkonicek and @nicklockwood to be potential reviewers. |
Text, | ||
TextInput, | ||
TouchableHighlight, | ||
Share, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@deminoth updated the pull request. |
FYI BUCK build is failing in circle CI. |
@deminoth updated the pull request. |
@deminoth updated the pull request. |
@deminoth updated the pull request. |
@satya164 @bestander Thanks :) |
@deminoth updated the pull request. |
@deminoth updated the pull request. |
@ericvicenti would you mind taking a look at this pull request? It's been a while since the last commit was reviewed. |
Now I think it's not a good idea making a new module... Maybe this feature should included in the Linking Module? |
Sorry this got neglected. Will review it soon. Why do you think this should be part of linking? |
@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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Thanks a lot @deminoth . Overall looks good. Just address the few things I mentioned and we can merge, |
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. |
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to Phabricator to review internal test results. |
3b35732
Thanks @deminoth for sticking with this and seeing it through. |
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
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
I still face this issue. |
@Themarsguy Can I get some more info? |
Hi, just curious, was there a reason why specifying an URL/image was not implemented on Android? Were there any hurdles with this? |
@IjzerenHein As I remember, the app chooser didn't support |
Alright, thanks for the feedback @deminoth 👍 |
@IjzerenHein Read documents and see https://github.com/facebook/react-native/tree/master/RNTester (was UIExplorer when I wrote this module) |
Alright, thanks for the tip @deminoth ! |
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 sharetitle
- title of the messageiOS
url
- an URL to shareAt least one of URL and message is required.
Options
iOS
excludedActivityTypes
tintColor
Android
dialogTitle