react-native-legit-story-share
v1.0.3
Published
A RN Native module package adopted from Jobeso's package but works with RN 0.60+
Downloads
34
Maintainers
Readme
react-native-legit-story-share
Getting started
$ npm install react-native-legit-story-share --save
Mostly automatic installation
$ react-native link react-native-legit-story-share
Be sure to install pods if developing for iOS
$ cd ios && pod install
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-legit-story-share
and addLegitStoryShare.xcodeproj
- In XCode, in the project navigator, select your project. Add
libLegitStoryShare.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.reactlibrary.LegitStorySharePackage;
to the imports at the top of the file - Add
new LegitStorySharePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-legit-story-share' project(':react-native-legit-story-share').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-legit-story-share/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-legit-story-share')
Usage
Share To Instagram
import RNLegitStoryShare from 'react-native-legit-story-share';
RNLegitStoryShare.isInstagramAvailable()
.then(isAvailable => {
if(isAvailable){
RNLegitStoryShare.shareToInstagram({
type: RNLegitStoryShare.BASE64, // or RNLegitStoryShare.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));