Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Share Multiple Files with Different Formats via Whatsapp on IOS #1524

Open
saikrishnagudipudiextwebtech opened this issue Apr 20, 2024 · 0 comments
Labels

Comments

@saikrishnagudipudiextwebtech
Copy link

Issue Summary

When attempting to share multiple files of different formats (such as VCF and image files) simultaneously via WhatsApp on iOS using the react-native-share package, the sharing process fails. This issue arises specifically when using the Share.open() method with the urls parameter containing URLs of the files to be shared.

Steps to reproduce

1.Implement a React Native application using the 'react-native-share' package
2. Attempts to share multiple files (e.g., a VCF file and an image file) via WhatsApp on ios at a time
3. Use the 'Share.open()' method with the 'urls' parameter containing URLs of the files.
4. Observe the WhatsApp fails to handle the shared files properly

Expected behavior

WhatsApp on IOS should be able to handle the sharing of multiple files of different formats simultaneously when using the 'react-native-share' package

Actual behavior

WhatsApp on iOS fails to properly handle the shared files, resulting in an unsuccessful sharing process.

Environment

  • React Native version: 0.61.3
  • Typescript version (if using typescript): 3.8+ required, what version is in your environment?

react-native-share

Version: 7.3.0

Link to repo (highly encouraged)

shareVCardAndQRCode = async () => {
let jpgImage = null;
let vCardDetail = vCardsJS();
vCardDetail.firstName = "John";
vCardDetail.lastName = "abc";
vCardDetail.workPhone = "+919999999999";
vCardDetail.url = "";
vCardDetail.email = "abc@gmail.com";
vCardDetail.organization = "abc";
let path = RNFS.CachesDirectoryPath + '/shareCard.vcf';
vCardDetail.saveToFile(path);

//using RNFS blob
let base64Image = '';
let imagePath = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQHJU-UAZ8Dg9RHVdn6hA9B5gjI8VfAuy0xUESg4HWGOA&s"
let imageUrl = imagePath;
RNFetchBlob
  .fetch('GET', imageUrl, {
  })
  .then(async(res) => {
    imagePath = res.path()
    base64Image = res.base64()
    
    try {
      RNFetchBlob
      .fetch('GET', imageUrl, {
      })
      .then(async(res) => {
        imagePath = res.path()
        base64Image = res.base64()
        
        try {
          await Share.open({
            message: '',
             urls:['data:image/png;base64,'+ base64Image, 'file://' + path, ],
              type: 'application/vcf',
          });

        } catch (err) {
          console.log("first", err)
        }
       
      })
    } catch (err) {
      console.log("error", err)
    }
  })  

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant