Share image directly to Social App


#1

I’m having trouble finding info / examples on a consistent way to share an image directly to a Social App (Instagram, Twitter, Facebook) in Expo.

  • I need it to work in Android and iOS.
  • I don’t want to pop up the OS’s share dialog; I want to launch directly into the Social App with the image, message and tags prefilled (as allowed/appropriate).
  • I’d rather not use SDKs.

I’ve tried react-native-share but I haven’t figured out if/how it works with Expo. Guidance from the community is much appreciated!


#2

Hey @dcanora,

This behavior isn’t possible with a standard Expo project. In order to achieve this, you would have to eject and use a third-party library such as react-native-share or implement it yourself by writing some native code. Ejecting creates the necessary ios and android directories that are required to be able to configure native code either manually or via react-native link. You can read more about this here: https://docs.expo.io/versions/v31.0.0/expokit/eject

Cheers,

Adam


#3

Thanks, @adamjnav. I ejected and have it working using react-native-share’s shareSingle to skip the OS share dialog.

Any suggestions how to do the same for MMS? Seems simple to do with text, but hard if not impossible to do with an image. (See Compose MMS and launch to phone messaging app in Expo / ExpoKit)

Happy New Year!
-d.


closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.