I\'ve spent an hours to find a way to send/share an image (and text if possible) into whatsapp app using react native,
I\'ve read this question (in android) and this
I was using react native 0.59 version but still i was not able to share image and text(including a link) on whatsapp because the default react native share gets either message or url so it is necessary to use react-native-share library https://github.com/react-native-community/react-native-share . I also used rn-fetch-blob library to convert image url to base64 image data.
shareImage= () => {
RNFetchBlob.fetch('GET', `https://example.com/example.png`)
.then(resp => {
console.log('response : ', resp);
console.log(resp.data);
let base64image = resp.data;
share('data:image/png;base64,' + base64image);
})
.catch(err => errorHandler(err));
share = base64image => {
console.log('base64image : ', base64image);
let shareOptions = {
title: 'Title',
url: base64image,
message: 'https://somelink.com some message',
subject: 'Subject'
};
Share.open(shareOptions)
.then(res => {
console.log(res);
})
.catch(err => {
err && console.log(err);
});
};
};