Reputation: 87
I'm trying to map array state to add it into urls
in react-native-share
But when I'm trying to share it, it shows Error: uriString
In the docs it should look like this:
urls: [image1, image2]
. How can I do it?
Code:
let shareImage = {
title: `Shared Job from Group ${groupID}`,
email: shareEmail,
message: `Group ID ${groupID} | License Number ${data.LicenseNumber}\nModel: ${data.Manufacturer} ${data.Model} ${data.ProductionYear}\nImages:`,
urls: [...imagesBase64]
};
try {
const shareResponse = await Share.open(shareImage);
console.log(JSON.stringify(shareResponse));
} catch (e) {
console.log('Error => ', e);
}
Upvotes: 0
Views: 77
Reputation: 87
I have fixed this issue.
I have generated the imagesBase64
inside an useEffect
hook.
And whenever useEffect
was called, it was adding the same images to the imagesBase64
. So to fix it, I'm resetting the imagesBase64
at the start of useEffect
.
Upvotes: 0