Share.shareSingle `Instagram` only opens AppStore, does not post to Instagram
Steps to reproduce
- Handle press action:
const shareItem = async () => {
const screenshot = await screenshotRef.current?.capture?.();
await Share.shareSingle({
backgroundImage: require('../../../assets/splash.png'),
social: Social.InstagramStories,
url: screenshot,
type: 'image/png',
appId: applicationId,
title: 'Test Title',
});
};
- Watch AppStore open
Expected behavior
Based on documentation, I was under the impression that I can share directly to Instagram. The behavior would be:
- on press of button in app, share menu opens or share to instagram menu opens
- choose "share" button from menu and Instagram will open with Store or Post based on settings above.
Actual behavior
-
It opens the AppStore directly.
-
Video: https://github.com/user-attachments/assets/aa3ff13e-f55e-440a-9ef2-a1e864045615
I am able to work around by using Share.open:
await Share.open({
// backgroundImage: require('../../../assets/splash.png'),
// social: Social.InstagramStories,
url: screenshot,
type: 'image/png',
// appId: applicationId || 'com.identafly.dev',
title: 'Test Title',
});
};
Environment
"expo": "^50.0.17",
"expo-media-library": "~15.9.2",
"react-native-share": "^10.2.1",
"react-native-view-shot": "3.8.0",
"react-native": "0.73.6",
react-native-share
Version: "^10.2.1"
+1
shareOptions = {
social: Share.Social.INSTAGRAM_STORIES,
appId: 'appId',
backgroundImage: `data:image/jpeg;base64,${base64Image}` as string,
backgroundBottomColor: '#ffffff' as string,
backgroundTopColor: '#000000' as string,
};
Perhaps it should be transmitted in base64
I had the same issue and figured out that it's not an issue with this package, just a matter of setting up your iOS LSApplicationQueriesSchemes permissions, as described in the docs. For an Expo app, that means adding the following to your app.json:
"ios": {
"infoPlist": {
"LSApplicationQueriesSchemes": [
"instagram-stories",
+1 got the exact same issue... Not using Expo btw. Followed the steps that where provided in the docs, but wasn't able to build the app afterwards...
+1 got the exact same issue... Not using Expo btw. Followed the steps that where provided in the docs, but wasn't able to build the app afterwards...
Interesting. What values do you currently have under LSApplicationQueriesSchemes in your info.plist?
+1 got the exact same issue... Not using Expo btw. Followed the steps that where provided in the docs, but wasn't able to build the app afterwards...
Interesting. What values do you currently have under
LSApplicationQueriesSchemesin your info.plist?
I just copied the rows from the docs:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
<string>mailto</string>
<string>instagram</string>
<string>instagram-stories</string>
<string>fb</string>
<string>facebook-stories</string>
</array>
And tried to share something to Instagram / Facebook
I just copied the rows from the docs:
<key>LSApplicationQueriesSchemes</key> <array> <string>whatsapp</string> <string>mailto</string> <string>instagram</string> <string>instagram-stories</string> <string>fb</string> <string>facebook-stories</string> </array>And tried to share something to Instagram / Facebook
very strange; once I got my Info.plist right, I didn't have any more issues.
My only thought then would be to make sure the request is correct. In my case, I use:
await Share.shareSingle({
social: Social.InstagramStories,
stickerImage: stickerPng,
backgroundImage: bgPng,
appId,
});
very strange; once I got my
Info.plistright, I didn't have any more issues.My only thought then would be to make sure the request is correct. In my case, I use:
await Share.shareSingle({ social: Social.InstagramStories, stickerImage: stickerPng, backgroundImage: bgPng, appId, });
At the moment I have made it like this:
const shareToPlatform = async (socialPlatform: string) => {
try {
const localImagePath = await downloadImage(images[0].url);
const shareOptions = {
title: 'Share via',
url: `file://${localImagePath}`,
type: 'image/jpeg',
social: socialPlatform,
};
await Share.shareSingle(shareOptions);
} catch (error) {
console.error(`Error sharing post to ${socialPlatform}:`, error);
}
};
const openPlatform = async () => {
if (platform === 'Facebook') {
await shareToPlatform(Social.Facebook);
} else if (platform === 'Instagram') {
await shareToPlatform(Social.Instagram);
} else {
console.warn('Unsupported platform');
}
};
And on Android sharing to Instagram is working flawless, while on iOS it just opens the App store...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and i will leave this open