const shareInstagramDM = async () => {
const shareOptions = {
title: 'Share dm',
social: Share.Social.INSTAGRAM_DIRECT,
};
try {
const ShareResponse = await Share.shareSingle(shareOptions);
} catch (error) {
console.log('Error =>', error);
}
};
Share.Social.INSTAGRAM_DIRECT is not working but Share.Social.WHATSAPP is working. But I need Instagram dm
const shareInstagramDM = async () => {
const shareOptions = {
title: 'Share dm',
social: Share.Social.INSTAGRAM_DIRECT,
};
try {
const ShareResponse = await Share.shareSingle(shareOptions);
} catch (error) {
console.log('Error =>', error);
}
};
Share.Social.INSTAGRAM_DIRECT is not working but Share.Social.WHATSAPP is working. But I need Instagram dm
Share Improve this question asked Feb 4 at 12:31 Sefa KAÇMAZSefa KAÇMAZ 11 bronze badge1 Answer
Reset to default 1Direct sharing to Instagram DMs is not officially supported by Instagram's API or the react-native-share
library. Your best bet is to use Instagram Stories or guide users to share content manually within the Instagram app.
import Share from 'react-native-share';
const shareToInstagramStory = async () => {
const shareOptions = {
backgroundImage: 'https://example/image.jpg', // URL or local file path
stickerImage: 'https://example/sticker.png', // Optional sticker
backgroundTopColor: '#ffffff', // Optional
backgroundBottomColor: '#000000', // Optional
social: Share.Social.INSTAGRAM_STORIES,
};
try {
await Share.shareSingle(shareOptions);
} catch (error) {
console.error('Error sharing to Instagram Story:', error);
}
};
shareToInstagramStory();