react-native-share: Share on instagram story doesn't work on Android

In my React Native app I’m using the following code to share content on instagram stories. On iOS, it works fine; however, on Android, it does not resolve the promise and does not display any error.

import { default as RNShare } from "react-native-share";

const shareOnInstagram = async (callback) => {
  const imageUrl =
    "https://images.unsplash.com/photo-1556035511-3168381ea4d4?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1674&q=80";

  /* Download image using expo-file-system */
  const base64 = await downloadImage({ url: imageUrl, isBase64: true });

  const shareOptions = {
    backgroundImage: imageUrl,
    stickerImage: "data:image/png;base64," + base64,
    backgroundBottomColor: "#fefefe",
    backgroundTopColor: "#906df4",
    social: RNShare.Social.INSTAGRAM_STORIES,
    appId: META_API_KEY,
  };

  RNShare.shareSingle(shareOptions).catch((err) => {
    console.log(err);
  });

  callback();
};

Here’s the specs:

"react-native": "^0.70.6"
"react-native-share": "^8.0.1"

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 26 (5 by maintainers)

Most upvoted comments

Add this queries into your androidManifset,xml file

 <queries>
  <package android:name="com.google.android.youtube" />
  <package android:name="com.facebook.katana" />
  <package android:name="com.facebook.orca" />
  <package android:name="com.facebook.mlite" />
  <package android:name="com.facebook.lite" />
  <package android:name="org.telegram.messenger" />
  <package android:name="com.whatsapp" />
  <package android:name="com.instagram.android" />
</queries>

same issue for me : when I try to share on instagram, it open the photo library on Android.

@adnandothussain I actually wrote a blogpost explaining the entire process, you can find the blog here.