react-native-share: SingleShare WhatsApp on iOS not working
Steps to reproduce
import Share from 'react-native-share';
const shareOptions = {
title: 'Share via',
message: 'some message',
social: Share.Social.WHATSAPP,
};
Share.shareSingle(shareOptions);
Expected behaviour
It should open the WhatsApp
Actual behaviour
App Crashes
Environment
- React Native version: 0.59.2
- React Native platform + platform version: iOS 12.3.1
react-native-share
Version: 1.1.3
RCTFatalException: Exception '*** -[__NSCFConstantString stringByAppendingString:]: nil argument' was thrown while invoking shareSingle on target RNShare with params (
{
message = "Hey! I\U2019m really exited to share the new app for stu...:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 27 (4 by maintainers)
Well it’s installed, that’s the issue… Opening via Linking.openURL('whatsapp://send?text=‘hello from RN’) works just fine.
On Thu, Oct 24, 2019 at 1:17 AM João Marins notifications@github.com wrote:
It seems like Whatsapp require an url instead of a message ? But it opens the AppStore for me instead of Whatsapp 😦 (v1.2.1)
Hi @imbudhiraja , i got a similar problem a time ago, and as i remember is was related to a specific param that WhatsApp on IOS doesn’t recognize. I ended using something similar to this:
I think you can omit the url param without any problem on your case. Btw, let me know if this helps you.
I don’t know if still relevant but on IOS you need to set on
Info.plistTo be able to open the WhatsApp
This looks like how WhatsApp handle this kind of content, when using their share api. Unfortunately i was able to share a image to WhatsApp, removing the message param.
Same problem here, and a tried with version 2.0