kbrk
kbrk

Reputation: 660

React Native sharing base64 image is not working

I am developing on android. My react-native version is 0.42. I'm using react-native-share package for sharing screen view. The data I want to share is being converted to base64.

...
const uri = "data:image/jpeg;base64,...";

Share.open({
  title: "Title",
  message: "Message",
  url: uri,
  subject: "Mail subject"
})
...

This process was working properly on whatsapp, facebook and email before. However, now, when I tried on whatsapp the response is 'Sharing failed. Please try again', on facebook I'm getting an empty text area without sharing options and on email I'm getting the text typed options except for the image.

Do you have any suggestion? Thank you.

Upvotes: 1

Views: 3414

Answers (1)

Shubhnik Singh
Shubhnik Singh

Reputation: 1329

I am using react-native-share but using the shareSingle option like this:

Share.shareSingle({
  message:'I just added a new outfit to my album.',
  url:Constants.image64, //base64 image
  social: "whatsapp"
});

It works great on both the platforms. You can try it if it suffice your needs.

Upvotes: 2

Related Questions