nygardk / react-share

Social media share buttons and share counts for React
MIT License
2.6k stars 430 forks source link

lib doesnt work with react 17? #441

Open x3malmusic opened 2 years ago

x3malmusic commented 2 years ago

so i installed the package, copy pasted code from this sandbox: https://codesandbox.io/s/rrlli?file=/src/App.js and none of the buttons appear, yes they appear in the DOM, but they are still invisible, even if i set display to block, set some height and width...still nothing.

The only difference between this sandbox and my code is react version, in sandbox it's 16 and i have a react 17 version. At this point i have a simple question does this library works with react 17?or am i doing something wrong?

x3malmusic commented 2 years ago

so it worked when i deleted class - react-share__ShareButton, but why it's there in the first place? i dont understand how to get rid of it

thongnv commented 1 year ago

same issue, that's because this class has style display: none !important

MuhammadSalmanSiddiqui commented 1 year ago

Manually remove this class from all share buttons. (Solution for react V >= 17) Example code:

useEffect(() => {
    const buttonList = document.querySelectorAll(".react-share__ShareButton");
    buttonList.forEach((item) =>
      item.classList.remove("react-share__ShareButton")
    );
  }, []);
artemdumanov commented 7 months ago

The same for me. Very weird issue.