react-native-share: Image Sharing for WhatsApp is not working
So I’m saving a screenshot locally and passing the URI to Share options. Its working fine for every platform except Whats App.
`let shareOptions = { title: “Share”, url: this.state.cameraRollUri, type: ‘image/png’, message: “Here it is”, subject: “Share Link”, // for email, };
Share.open(shareOptions)`
Just message appears but no image
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 32 (6 by maintainers)
@iSaadSalman can you please check after removing ‘message’ from options, if it is working or not. Whatsapp only allows one of them to be used, i.e. you can only use message or url at a time for whatsapp.
The issue is only on iOS. For Android it works well. Any update on this?
I have found a working workaround for this problem. Currently, I also use it in one of my applications. You can directly plug and play the below onClick function on a button press.
RNFS.downloadFile, downloads the remote image using URL and save it to a path. RNFS.readFile, converts the locally saved file data to base64 which is supported directly by Whatsapp and other applications.
Url is the image remote URL and id is some unique identifier for that image.
share image on WA work on my Device, and shareOption like this
then i add code
on file WhatsAppShare.m line 49
@jgcmarins If you can, maybe add a readme note about this so people know
any update?
The problem with message override still exists. Url does not work if I add a message field. Tested with version 1.1.3.