react-share
react-share copied to clipboard
[Error] EmailShareButton is not working
<EmailShareButton style={{ margin: '0.5rem' }} url={publicUrl} subject='t' body="<div>test</div>">
<EmailIcon size={60} round />
</EmailShareButton>,
Here is my code when I click button, nothing happen
my package is
"react": "^16.12.0",
"react-share": "^4.0.1",
That is weird. Were you able to fix the issue?
The same issue with Twitter share button
same issue with almost every component
@nygardk @JaeWangL did you guys find the isuue i am facing same issue
problem with email share button
Also dealing with this issue - the button does not respond to any clicks. I'm also using the share buttons for Pinterest, Facebook, Twitter that successfully perform their actions.
I guess you haven't set default app for reading mail. If you are using window 10, you can try: https://www.officetooltips.com/office_2016/tips/how_to_modify_default_mail_client_in_windows_10.html
Do the similar thing with other OS
how to share through gmail without using defaul mail reading app
Same here. Using the HTML anchor tag with mailto inside the href works fine. In the console, i get Uncaught TypeError: b is not a function
same here with email, I am on windows 10 and my default email app is google chrome. I also agree there should be a way to set a fallback.
I haven't investigated, but it seems a trick to see if the user has a working email client is to check the onBlur event (if it fires, it means it worked)
https://www.uncinc.nl/nl/articles/dealing-mailto-links-if-no-mail-client-available (old post with jQuery, but the code would obviously be working fine in native js)
$(window).blur(function() {
// The browser apparently responded, so stop the timeout.
clearTimeout(t);
});
t = setTimeout(function() {
// The browser did not respond after 500ms, so open an alternative URL.
document.location.href = '...';
}, 500);
I just pulled the repo and ran the demos locally. The email button, with the email icon nested as a child, works just fine. Could be something in the Webpack config?
Exact same behaviour for me as for @tareqdayya - the demo work locally just fine, but none of the share buttons do anything when imported into my React 16.13.1 project.
@blasphemic I've used this workaround until it gets fixed:
const handleEmailOnClick = () => {
window.location.href = encodeURI(`mailto:
?subject=${Some.Variable} Subject Here
&body=Hi,\n\nYou Can bla Bla bla "${some.variable}" At ${url}\n\nEnjoy,`);
};
return (
<EmailShareButton url={MY_URL} onClick={handleEmailOnClick}>
<EmailIcon />
</EmailShareButton>
);
Hello, one more guy bumping into the issue here 👋
@tareqdayya thanks, I tried the approach you suggested and it worked on most of the browsers I needed, unfortunately, except Safari on iOS.
Ended up rendering just an anchor tag with mailto:...
and styling it to match the rest of my share buttons.
Hello, one more guy bumping into the issue here @tareqdayya thanks, I tried the approach you suggested and it worked on most of the browsers I needed, unfortunately, except Safari on iOS. Ended up rendering just an anchor tag with
mailto:...
and styling it to match the rest of my share buttons.
how to use that anchor tag into our