Skip to content

PierreCapo/react-native-image-to-socials

Repository files navigation

react-native-image-to-socials

WIP Share images to social networks. New architecture only. Works on iOS only. Support for Android incoming.

Installation

npm install react-native-image-to-socials

iOS

  1. In your Info.plist ensures that Instagram is authorized
<key>LSApplicationQueriesSchemes</key>
  <array>
    <string>instagram</string>
    <string>instagram-stories</string>
  </array>
  1. In your Info.plist ensures that NSPhotoLibraryUsageDescription is set up. It is used because the function shareToInstagram needs to save the image in the Photo Library before being able to forward it to Instagram.
<key>NSPhotoLibraryUsageDescription</key>
<string>Description string</string>

Usage

shareToInstagram(imageUri: string)

import { shareToInstagram } from 'react-native-image-to-socials';

// This opens directly instagram and prompt to use it either as a
// imageUri is local. Check example/App.tsx as an example.
await shareToInstagram(imageUri);

drawing

shareToInstagramStory(appId: string, imageUri: string, backgroundImageUri?: string)

import { shareToInstagramStory } from 'react-native-image-to-socials';

// imageUri is local. Check example/App.tsx as an example.

// your appId found in Meta. This opens directly a story post
await shareToInstagramStory(appId, imageUri);

drawing

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library