Share API support for sharing URLs on Android
Weeravit Sirita
https://facebook.github.io/react-native/docs/share.html does not support sharing URLs on Android, only on iOS.
udi
It seems like this is still an issue in 2023? How can I share an http(s) url on android in an Expo app? Do I have to eject just for this? Thanks
Michael Wood
udi: If you were to switch to the bare workflow, how would you accomplish this? You ought to be able to use the same thing in the managed workflow, possibly with a config plugin
udi
Michael Wood: Thanks I may have to try that. Just seems very odd. Almost all sharing these days happens by url. Should be the default style. I guess I'll just share a message with the url as the text for now?
Michael Wood
udi: I have fortunately not had a need for this myself. But if you find a way to do this in a plain React Native app then you should be able to get help writing a config plugin on Discord (https://chat.expo.dev) or on the Expo forums
Rob Holic
Please integrate react native share into expo!
hiThereJake
I don't know why this issue has been neglected but on revisiting this issue I had to put on the back burner I found that the expo-sharing library supports this. I am now able to share a url on android! Here is the link: https://docs.expo.io/versions/v36.0.0/sdk/sharing/#sharingshareasyncurl-options
Jimm Loller
hiThereJake: this is only for local urls (file:///), not for external https:// :(
hiThereJake
Jimm Loller: Ah I see, well lucky for me that fits my current use case. Sorry to hear it doesn't help you out any. Best wishes.
Connor Cunningham
It should be noted that the inability to share a URL on Android makes apps that integrate with Facebook's SDK in violation of Facebook's Platform Policies. Facebook requires a URL in shared content, and does not allow prefilling quotes. We were recently contacted by Facebook about this issue.
FB Policy on Prefilling (14.5.a):
Ariel Falduto
Any update with this feature?
Y
Yassine El Bouchaibi
Since SDK33, you can use Expo Sharing to share any type of file to other apps that can handle its file type even if you're on Android.
Usage is pretty simple :
import * as Sharing from 'expo-sharing'; // Import the library
Sharing.shareAsync(url) // And share your file !
Aladin Bouzerd
Yassine El Bouchaibi: This is for sharing fils, not for sharing a content with a URL
Y
Yassine El Bouchaibi
Aladin Bouzerd: you’re right, however if you want to share an image on Android without ejecting from expo this is the only way
hiThereJake
Aladin Bouzerd: I was able to share an image (aka content) with a url
Pawel
Any future plans on this?
Amardeep Singh
Any update on this please?
Yevhenii Shabelnyk
It can be fixed with react-native-share library https://github.com/react-native-community/react-native-share. Brent Vatne Is there any possibility to add this library in Expo? Should I create feature request for this?
Lim Wen jie
Yevhenii Shabelnyk: Agree. The "Share" API provided by RN is quite limited by its own. I would love to see Expo integrate react-native-share into Expo SDK API, as react-native-share requires react-native-link (which requires eject from Expo, which I would like to avoid)
a
This is RN specific and not Expo.
Load More
→