react-native-share / react-native-share

Social share, sending simple data to other apps.

Home Page:https://react-native-share.github.io/react-native-share

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Share.shareSingle is not working in case of Samsung's dual messenger enabled (whatsapp share)

parasduttbusy opened this issue · comments

Steps to reproduce

  1. Enable dual messenger feature on samsung mobile, which results in having two WhatsApp running separately

Code of WhatsApp share function

const whatsappShare = async () => {
        try {
            let phone = getPhoneNumber() // getting from server
            const shareOptions = {
                title: '',
                email: '',
                subject: '',
                message: 'This is a Default message',
                social: Share.Social.WHATSAPP,
                whatsAppNumber: phone, // country code + phone number
                // filename: '', // only for base64 file in Android
            };

            Share.shareSingle(shareOptions)
                .then((res) => {
                        console.log(res);
                })
                .catch(() => {
                    toastr.showToast(
                        errorMessages('whatsAppError'),
                        'danger',
                        2000,
                    );
                    setDisable(false);
                });
        } catch (e) {
            console.log(e)
        }
    };

Expected behavior

When I click on WhatsApp share button I made in the UI of my application the dialog box of phone opens up asking to choose which WhatsApp I have to use (as I am using dual messenger) and their are two cases possible after that
Case 1: If I got the phone number from server (in code) then the WhatsApp chat of that phone number should open with the message auto-filled on the chat
Case 2: If I doesn't have phone number then WhatsApp should open the contacts page in WhatsApp so that user can choose from it's contacts to send message

Actual behavior

When I click on WhatsApp share button I made in the UI of my application the dialog box opens up asking to choose which WhatsApp I have to use but when I click on any WhatsApp which I want to use this happens
Case 1: So when I have phone number in code then the chat of that particular phone number opens up but with no auto-filled message which I am sending from code
Case 2: And when I do not have the phone number (empty) then the WhatsApp doesn't opens, just the dialog appears and when I choose which WhatsApp to use then the dialog closes and on console I have the success message which I am logging in code.
{"message": "com.whatsapp", "success": true}

It is working normally as written in expected behavior in the case if I don't have dual messenger enabled and in cases of cloned apps in other phones (other than Samsung)

Environment

  • React Native version: "0.70.3"
  • React Native platform + platform version: Android 12

react-native-share

Version: 10.0.2