chai86
chai86

Reputation: 443

How to share from React Native to Instagram?

I'm using React Native to create an iOS app. However i would like to share a uri to an S3 video as follows:

import React from 'react'
import { Share, Linking ....} from 'react-native'

//button and run function
testShareInsta = async () => {
     const uri = "https://s3-dev.s3-us-west-1.amazonaws.com/video/myvideo";
     let encodedURL = encodeURIComponent(uri);  
     let instagramURL = 'instagram://library?AssetPath=${encodedURL}';
     return Linking.openURL(instagramURL);
  }

What can i do to make this work?

Upvotes: 2

Views: 10116

Answers (2)

NIKHIL DANGI
NIKHIL DANGI

Reputation: 147

import Share from 'react-native-share';

const options = {
  title: 'XYZ',
  message:"HELLO",
  social: Share.Social.INSTAGRAM,
};
const shareResponse = await Share.shareSingle(options);

Upvotes: 0

Tuan Luong
Tuan Luong

Reputation: 4162

  1. Download video using rn-fetch-blob
  2. Store your video to camera roll using react-native-camera
  3. Share your video to instagram using @react-native-social-share/instagram. Disclaimer: I am the owner of this lib

Upvotes: 1

Related Questions