react-native-legit-story-share

1.0.3 • Public • Published

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-legit-story-share and add LegitStoryShare.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libLegitStoryShare.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
    
  2. 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));

Package Sidebar

Install

npm i react-native-legit-story-share

Weekly Downloads

11

Version

1.0.3

License

MIT

Unpacked Size

57.7 kB

Total Files

39

Last publish

Collaborators

  • bobber205