1

I'm trying to use react-native-share to share a QR code on my react native app, unfortunately once I press the send button to share the image the app crashes and sometimes the share is completed sometimes it isn't. I'm not sure were this error might be happening. Opening the share is slower than usual. This is the function were I make the share:

async ShareQR(media) {
    var base64Data = "data:image/png;base64," + media
    const title = "App"

    const shareOptions = {
        url: base64Data,
        title: title,
        message: 'App'
    }
    try {
        const res = await Share.open(shareOptions, function(e) {
            console.log(e)
        })
        console.log(res)
    } catch (err) {
        console.log("This error", err)
    }
}

I have tried the promise and the async await implementations and it gives me the same error. I'm using RN version 0.68.1 and react-native-share 7.6.6 Some images in case I'm not being clear enough:

Share options

gmail share

after send button pressed

Any help would be greatly appreciated!!! Thanks!!

user3487815
  • 15
  • 1
  • 5

1 Answers1

0

Note: If your application requires the ability to share base64 files on Android, you need to add

<!-- required for react-native-share base64 sharing -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

to your application's AndroidManifest.xml file as per the example project.

Saw it on the official documentation:

https://react-native-share.github.io/react-native-share/docs/install

Erick Gutierrez
  • 446
  • 3
  • 7