hiiamstuck
hiiamstuck

Reputation: 61

Save and share image from project's assets in React Native

Is it possible to save an image coming from project's assets folder in the gallery and/or share it using the Share api in React Native? If not is it possible to do it natively in Android and iOS?

Upvotes: 2

Views: 1594

Answers (1)

Pritish Vaidya
Pritish Vaidya

Reputation: 22189

I would suggest you to use react-native-share library, since the React Native's share library' features are limited, and url sharing is only supported in IOS

Here are the useful methods available

  • url: URL you want to share (you can share a base64 file url only in iOS & Android // You need this one.

You can share via base64 or file url directly

The example is really simple to use

let shareImageBase64 = {
  title: "React Native",
  message: "Hola mundo",
  url: REACT_ICON,
  subject: "Share Link" //  for email
};

Share.open(shareImageBase64)

Upvotes: 1

Related Questions