Odium
Odium

Reputation: 87

React-Native-Share - [Error: User did not share]

I'm having trouble with sharing email. I'm trying to share email with URL. It opens the Gmail form and fills all the data but when I'm clicking on send button It shows an error [Error: User did not share].

Code:

let imagePath = null;

                RNFetchBlob.config({
                    fileCache: true
                })
                    .fetch("GET", imagesUrls[0])
                    .then(resp => {
                        imagePath = resp.path();
                        return resp.readFile("base64");
                    })
                    .then(async (base64Data) => {
                        var imageUrl = 'data:image/png;base64' + base64Data;

                        let shareImage = {
                            subject: `Shared Job from Group ${groupID}`,
                            email: shareEmail,
                            message: `Group ID ${groupID} | License Number: ${data.LicenseNumber}\n 
    Model: ${data.Manufacturer} ${data.Model} ${data.ProductionYear}\n
    Images:`,
                            url: imageUrl,
                            // urls: [imageUrl, imageUrl]

                        };

                        const shareResponse = await Share.open(shareImage)
                            .then((res) => {
                                console.log(res);
                            }).catch((err) => {
                                err & console.log(err);
                            })

                        // return fs.unlink(imagePath)
                    })

Form:
Screenshot

After clicking on the blue share button It sends an error to the console and brings me back to my app.

Upvotes: 2

Views: 1327

Answers (0)

Related Questions