shareSingle from react-native-share does not work for WhatsApp in Android 11

1.5k views Asked by At

React Native Share singleShare is not working. Tried out everything as mentioned in the blog post here:

https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9

Still no luck. Please help.

Code snapshot:

let shareOptions = {
    title: 'Share via WhatsApp',
    message: 'Hey Check out this product',
    type: 'image/jpeg',
    url: urlString,
    filename: 'Awesome_Product',
    social: Share.Social.WHATSAPP,
    whatsAppNumber: 'number',
  };

Share.shareSingle(shareOptions)
      .then(resp => {
        console.log(resp);
      })
      .catch(_err => showToast('WhatsApp is not installed on the device.'));
1

There are 1 answers

0
Anton On

Did you actually add the <package android:name="com.whatsapp" /> to the android manifest?

<queries>
...
   <package android:name="com.whatsapp" />
</queries>