简体   繁体   中英

react-native-share App crashing after trying to share Android

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!!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM