react-twitter-embed icon indicating copy to clipboard operation
react-twitter-embed copied to clipboard

onClick event for follow button

Open BaliBalo opened this issue 5 years ago • 2 comments

Lets people add an onClick property as a function to be called whenever the twitter button is clicked. Use cases: tracking, user feedback, etc.

I tried to follow the coding conventions of the repo, let me know if anything is incorrect.

BaliBalo avatar Jul 17 '19 14:07 BaliBalo

@saurabhnemade Desperately need this functionality for my project

kgdiem avatar Apr 05 '20 15:04 kgdiem

Scratch that! Just realized it is only for button!

~However, @BaliBalo , I installed your version from github and implemented like so, to no avail. The event is never called~

<TwitterTweetEmbed
        placeholder={<div className={classes.placeholder} />}
        tweetId={article.tweet}
        options={OPTIONS}
        onClick={(e) => onClick(e)}
/>
function onClick(event) {
    event.preventDefault();
    event.stopPropagation();

    console.log(event.target);
  }
"react-twitter-embed": "BaliBalo/react-twitter-embed#features/onClick-follow-button",

kgdiem avatar Apr 05 '20 15:04 kgdiem

Closing due to conflicts with new TypeScript code and lack of interest - if someone feels like it, feel free to port this code in a new PR

BaliBalo avatar Jun 17 '24 16:06 BaliBalo