react-native-share: Instagram on iOS: the Instagram share option doesn't appear in the standard iOS menu when the message option is passed to open()

I tried installing both the current release and what’s on the master branch. Both are producing this issue:

      await RNShare.open({
        url: `data:image/jpeg;base64,${base64data}`,
        type: "image/jpeg",
        message: 'test share message',
      });

When you pass a message option, the icon to share to Instagram disappears from the standard iOS share menu. If you remove the message option, the Instagram option comes back and you can share the image successfully.

Instagram works fine in both scenarios on Android.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 25 (8 by maintainers)

Most upvoted comments

Workaround: React Native has a built in { Share } feature which works as expected on iOS, messages degrade gracefully on Facebook and Instagram. Only issue with the built in share is that you cannot supply a url for Android, so I just use Platform.OS to use React Native’s Share for iOS and react-native-share for Android.

import { Platform, Share } from "react-native";
import AndroidShare from "react-native-share";

const share = (url) => {
    if (Platform.OS === "ios") {
      const content = {
        message: this._message,
        title: this._title,
        url,
      };
      const options = {
        subject: this._subject,
      };
      const result = await Share.share(content, options);
      return result === Share.sharedAction;
    } else if (Platform.OS === "android") {
      const options = {
        message: this._message,
        title: this._title,
        subject: this._subject,
        url,
      };
      try {
        await AndroidShare.open(options);
        return true;
      } catch (error) {
        return false;
      }
    }
  }
};

Posting here so I don’t forget since it’s the next step I can think of for this issue: Compare react-native@0.56 iOS share module/ActionSheetManager with react-native-share and react-native@0.55 to see what changed…

Right, similar to Facebook share dialogs, I expect Instagram may not allow “default messages” being passed via an SDK. However, the Facebook share option degrades gracefully by ignoring the message option but still attaching an image (in my testing). It would be great if the Instagram option did the same instead of the icon disappearing entirely. 😞