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

Share does not support url on Android #18993

Closed
3 tasks done
James2516 opened this issue Apr 23, 2018 · 14 comments
Closed
3 tasks done

Share does not support url on Android #18993

James2516 opened this issue Apr 23, 2018 · 14 comments
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@James2516
Copy link

James2516 commented Apr 23, 2018

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 9.8.0
Yarn: -
npm: 5.6.0

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.1 => 0.55.1

Steps to Reproduce

https://facebook.github.io/react-native/docs/share.html#ios
Why does it only support url prop on iOS? Is there some other way to share a file on Android?

@MarkOSullivan94
Copy link

MarkOSullivan94 commented Apr 25, 2018

Experiencing this issue as well in our app. Did a bit of digging into the React Native source code and you can find the js function used to share content here:

static share(content: Content, options: Options = {}): Promise<Object> {

That ties in with the ShareModule on Android. I had a look through the code and found it's only looking for title and message in the share content.

Title

Message

For the ShareModule to work with images on Facebook it would need something like this added


        Intent shareIntent = new Intent();
        shareIntent.setAction(Intent.ACTION_SEND);
        shareIntent.putExtra(Intent.EXTRA_TEXT,"TITLE: This is a test share");
        shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
        shareIntent.setType("image/*");
        startActivity(Intent.createChooser(shareIntent, "Share image via:"));

I did a couple of tests with apps on my Pixel 2 and this code allows you to share a text and image for:

  • Twitter
  • Gmail
  • WhatsApp (think the text is an image caption)

Or just an image for:

  • Facebook
  • Facebook Messenger
  • Instagram

I think the only thing which needs to be passes from the Share.js is the uri or a location to generate the uri ( Uri.parse(imageLocation) ) should hopefully work.

In my opinion should be two functions in Share.js because I know not everyone will want to show an image, so there should be shareText and shareImage functions.

@James2516
Copy link
Author

@MarkOSullivan94 what about sharing a file? Could you submit a PR if you know how to fix it? The implementation from react-native-share seems non-trivial.

@MarkOSullivan94
Copy link

MarkOSullivan94 commented May 12, 2018

Honestly I have no idea how I would go about testing my changes.

I've just done a bit of reading up on contributing to the project but after reading up on the How to Contribute guide, I walked away not knowing how I'm supposed to be able to run my changes to the RN project with my existing RN projects.

I tried messaging in the #need-help channel and the #react-native channels in the Reactiflux discord server seeking advice but got no response.

Edit: I found a document to explain how to test changes! Might look into trying to see if I can get a fix for this in the next couple of weeks.

@kevinscience
Copy link

I really need to share a url on Android. Because Facebook is showing nothing! And what's the meaning for this whole Share module if there is nothing to share.

@antonioaltamura
Copy link

I honestly think this is a huge lack for this module, I can't believe it..

The @MarkOSullivan94 solution involves native "hacks", so even if it works it can't be used inside Expo.

@MarkOSullivan94
Copy link

@antonioaltamura what you mean it wont work with Expo?

@antonioaltamura
Copy link

Uhm I saw java edits and I thought they were in android directory.
I recheck you post I guess I was wrong, didn't test yet but looks doable even in Expo.

@MarkOSullivan94
Copy link

MarkOSullivan94 commented May 24, 2018

Have been unable to test my changes to the RN project for this. Hopefully once I get help with my issue (#19358), I'll be able to get my changes to work, allowing for the sharing of images for Android in RN Share API.

@stale
Copy link

stale bot commented Aug 22, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 22, 2018
@James2516
Copy link
Author

stale--

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 22, 2018
@MarkOSullivan94
Copy link

Hit another block #21776

@MarkOSullivan94
Copy link

Another block hit #22118

I would be great if someone with a running local build of React Native can test these changes for me.

@Titozzz
Copy link
Collaborator

Titozzz commented Mar 19, 2019

Hello there 👋 this issue seems more of a precise feature request than a bug report. For this reason, we'd prefer for you to post it to Canny so that it can be prioritized against the FR already there (maybe someone already submitted it!), or you can create a pull request 👍

@Titozzz Titozzz closed this as completed Mar 19, 2019
@MarkOSullivan94
Copy link

@Titozzz I think it would be a good idea for you to post it to Canny first and then link it in here before closing this issue, means you wont have numerous people who read your post going there and posting the same idea over and over again.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants