i am I am using the React-Native Share. But isn’t supported in Web. It gives the following error.
Error: Share is not supported in this browser
How can i use it with browser support?
const onShare = async () => {
try {
// console.log(data);
const result = await Share.share({
message: `WSLRemit transfer receiptnnTransfer number: ${Transaction?.manual_payment_ref} nThey get: ${Transaction?.recipient_gets} ${Transaction?.target_currency}nYou sent: ${Transaction?.nominal} ${Transaction?.source_currency}nTotal paid: ${Transaction?.total} ${Transaction?.source_currency}`,
});
if (result.action === Share.sharedAction) {
if (result.activityType) {
// shared with activity type of result.activityType
} else {
// shared
}
} else if (result.action === Share.dismissedAction) {
// dismissed
}
} catch (error) {
// alert(error.message);
console.log(error);
}
};
2
Answers
Import it from ‘react-native’
like
it will work on web as-well.
You need to run the site using ssl and it only appears to work on a mobile device. I couldn’t get it to work on desktop at all.
For example, for expo you can run it like this:
expo start --https