Share your images to instagram stories.
OS | Type | Supported |
---|---|---|
iOS | BASE64 | YES |
FILE | YES | |
Android | BASE64 | YES |
FILE | NO |
$ npm install rn-instastory-share --save
$ react-native link react-native-story-share
- add
instagram-stories
andsnapchat
to theLSApplicationQueriesSchemes
key in your app's Info.plist.
...
<key>LSApplicationQueriesSchemes</key>
<array>
...
+ <string>instagram-stories</string>
</array>
...
$ cd ios
$ pod install
import RNStoryShare from "rn-instastory-share";
RNStoryShare.isInstagramAvailable()
.then(isAvailable => {
if(isAvailable){
RNStoryShare.shareToInstagram({
type: RNStoryShare.BASE64, // or RNStoryShare.FILE
attributionLink: 'https://myproject.com',
backgroundAsset: 'data:image/png;base64,iVBO...',
stickerAsset: 'data:image/png;base64,iVBO...',
backgroundBottomColor: '#f44162',
backgroundTopColor: '#f4a142'
});
}
})
.catch(e => console.log(e));
Name | Value |
---|---|
BASE64 | "base64" |
FILE | "file" |
Return a boolean indicating if Instagram is available on the phone.
type ShareConfigObject = {
type: "base64" || "file",
attributionLink: string,
backgroundAsset: string,
stickerAsset: string,
stickerOptions: {
height: integer,
width: integer
}
}
Shares a file or base64 image as background, sticker or both to Instagram. The background colors are only applyed when no background asset is set.