nygardk / react-share

Social media share buttons and share counts for React
MIT License
2.64k stars 433 forks source link

Different results ShareCount #305

Open NekitCorp opened 4 years ago

NekitCorp commented 4 years ago

I use VKShareCount and FacebookShareCount:

<FacebookShareCount url={url}>
    {shareCount => `+${shareCount}`}
</FacebookShareCount>
<VKShareCount url={url}>
    {shareCount => `+${shareCount}`}
</VKShareCount>

At zero share counts, the argument shareCount is different. Facebook returns undefined, when VK returns 0. Accordingly, this condition https://github.com/nygardk/react-share/blob/master/src/hocs/createShareCount.tsx#L62 is not fulfilled in the first case and is fulfilled in the second. This leads to the results:

Example

DigitalData commented 4 years ago

I'm getting the same issue with the FacebookShareCount component.

This could have something to do with the extra hoops you need to jump through to get an "engagement count" from Facebook (needing an access token). There was a PR that changed the component (#237), but I'm not sure if it's the culprit. Following directions from the PR and generating an access token, I still get an undefined result. I also get a react warning saying that it does not recognize the property "accessToken", and that it will only consider "accesstoken" instead.

I'm sure i've been no help, but there's my take :P