Socket
Socket
Sign inDemoInstall

react-share

Package Overview
Dependencies
120
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.4.1 to 5.0.0-rc.0

dist/index.cjs

87

package.json
{
"name": "react-share",
"version": "4.4.1",
"version": "5.0.0-rc.0",
"description": "Social media share buttons and share counts for React.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"module": "./es/index.js",
"type": "module",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.umd.cjs",
"types": "./dist/index.d.ts"
}
},
"sideEffects": false,
"engines": {
"node": ">=6.9.0",
"npm": ">=5.0.0"
},
"files": [
"lib/**/*",
"es/**/*"
"dist"
],
"scripts": {
"build": "npm run lint && npm run build:commonjs && npm run build:es",
"build:commonjs": "rimraf ./lib && tsc -p . --outDir ./lib --module commonjs",
"build:es": "rimraf ./es && tsc -p . --outDir ./es --module es2015 --moduleResolution Node",
"build-demo": "rimraf ./docs && cross-env NODE_ENV=production webpack -p --config webpack.demo.config.js",
"run-demos": "webpack-dev-server --hot --config webpack.demo.config.js --progress",
"build": "vite build",
"build-demo": "vite build --config vite.demo.config.js",
"check-types": "tsc --noEmit",
"demo": "vite --config vite.demo.config.js",
"lint": "eslint --ext .js,.jsx,.ts,.tsx ./src ./demo",
"prepublishOnly": "npm run build",
"start": "npm run run-demos"
"start": "npm run run-demos",
"release": "npm build && changeset publish"
},

@@ -55,36 +58,26 @@ "keywords": [

"devDependencies": {
"@types/assert": "1.5.6",
"@types/jsonp": "0.2.1",
"@types/react": "^16.9.49",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"cross-env": "7.0.3",
"css-loader": "6.7.1",
"eslint": "8.25.0",
"eslint-config-prettier": "^8.5.0",
"@types/assert": "1.5.9",
"@types/jsonp": "0.2.3",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"@vitejs/plugin-react": "^4.2.0",
"eslint": "8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "7.31.10",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-webpack-plugin": "^3.2.0",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.5.0",
"prettier": "2.7.1",
"react": "16.8.0",
"react-dom": "16.8.0",
"react-hot-loader": "4.13.0",
"rimraf": "^3.0.2",
"style-loader": "3.3.1",
"terser-webpack-plugin": "5.3.6",
"ts-loader": "9.4.1",
"typescript": "4.8.4",
"url-loader": "4.1.1",
"webpack": "5.74.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.11.1"
"prettier": "3.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typescript": "^5.2.2",
"vite": "^5.0.0",
"vite-plugin-dts": "^3.6.3"
},
"dependencies": {
"@changesets/cli": "^2.26.2",
"classnames": "^2.3.2",

@@ -94,4 +87,4 @@ "jsonp": "^0.2.1"

"peerDependencies": {
"react": "^16.3.0 || ^17 || ^18"
"react": "^17 || ^18"
}
}

@@ -6,10 +6,6 @@ # react-share

> Social media share buttons and share counts for React.
> Social media share buttons and share counts for your React project.
<img src="example.png" alt="Share buttons and counts example" />
![Share buttons screenshot](example.png)
Migrating from v2 to v3? Read [changelog](./CHANGELOG.md).
Migrating from v1 to v2? Read [migration notes](./migrate-v1-to-v2.md).
### Features

@@ -40,2 +36,3 @@

- Hatena
- Gab
- email

@@ -55,5 +52,7 @@ - share counts for

[View demo](http://nygardk.github.io/react-share/)
[View deployed demo](https://npm-react-share-demo.netlify.app)
To run demo: clone repo and run `npm install && npm run run-demos`
[Codesandbox example](https://codesandbox.io/p/sandbox/react-share-demo-474q4k)
To run demo locally: clone repo and run `npm install && npm run run-demos`
and open `http://localhost:8080`.

@@ -64,17 +63,16 @@

```shell
npm install react-share --save
npm install react-share
```
## Compatibility
## React compatibility
**Version 1.x.x**: compatible with React versions `0.13.x`, `0.14.x` and `15.x.x`.
| Version | Compatible React versions |
| ------- | ----------------------------- |
| 1 | `0.13.x`, `0.14.x`, `15.x.x`. |
| 2 | `15`, `16` |
| 3 | `15`, `16` |
| 3.0.1 | `^16.3.` |
| 4 | `^16.3`, `17`, `18` |
| 5 | `17`, `18` |
**Version 2.x.x**: compatiblity is tested with React 15 and 16.
**Version 3.x.x**: compatiblity is tested with React 15 and 16.
**Version 3.0.1**: compatible with React ^16.3.
**Version 4.x.x**: compatible with React >=16.3.
## API

@@ -88,2 +86,3 @@

FacebookShareButton,
GabShareButton,
HatenaShareButton,

@@ -105,3 +104,3 @@ InstapaperShareButton,

WhatsappShareButton,
WorkplaceShareButton
WorkplaceShareButton,
} from "react-share";

@@ -112,26 +111,26 @@ ```

| | Required props | Optional props |
| ---------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| | Required props | Optional props |
| ---------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **All** | **`children`** (string/element): React node<br />**`url`** (string): URL of the shared page | **`disabled`** (bool): Disables click action and adds "disabled" class<br/>**`disabledStyle`** (object, default=`{ opacity: 0.6 }`): Disabled style<br/>**`windowWidth`, `windowHeight`** (number, different default for all share buttons): opened window dimensions<br />**`beforeOnClick`** (`() => Promise`/`() => void`): Takes a function that returns a Promise to be fulfilled before calling `onClick`. If you do not return promise, `onClick` is called immediately.<br/>**`openShareDialogOnClick`** (boolean): Open dialog on click. Defaults to `true` except on EmailShareButton<br/>**`onShareWindowClose`** (`() => void`): Takes a function to be called after closing share dialog.<br/>**`resetButtonStyle`** (boolean, default=`true`): Reset `button` element style. Preferred to be set to `false` if you want to customize the button style. |
| EmailShareButton | - | **`subject`** (string): Title of the shared page<br/>**`body`** (string): Email, will be prepended to the url.<br/>**`separator`** (string, default=`" "`): Separates body from the url |
| FacebookShareButton | - | **`quote`** (string): A quote to be shared along with the link.<br/>**`hashtag`** (string): A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. |
| FacebookMessengerShareButton | **`appId`** (string): Facebook application id | **`redirectUri`** (string): The URL to redirect to after sharing (default: the shared url).<br />**`to`** (string): A user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients. |
| HatenaShareButton | - | **`title`** (string): Title of the shared page |
| InstapaperShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page |
| LinkedinShareButton | - | **`title`** (string): Title of the shared page<br/>**`summary`** (string): Description of the shared page<br/>**`source`** (string): Source of the content (e.g. your website or application name) |
| LineShareButton | - | **`title`** (string): Title of the shared page |
| LivejournalShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page |
| MailruShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page<br/>**`imageUrl`** (string): An absolute link to the image that will be shared |
| OKShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page<br/>**`image`** (string): An absolute link to the image that will be shared |
| PinterestShareButton | **`media`** (string): An absolute link to the image that will be pinned | **`description`** (string): Description for the shared media. |
| PocketShareButton | - | **`title`** (string): Title of the shared page. Note that if Pocket detects a title tag on the page being saved, this parameter will be ignored and the title tag of the saved page will be used instead. |
| RedditShareButton | - | **`title`** (string): Title of the shared page |
| TelegramShareButton | - | **`title`** (string): Title of the shared page<br/> |
| TumblrShareButton | - | **`title`** (string): Title of the shared page<br/>**`tags`**: (`Array<string>`)<br/>**`caption`** (string): Description of the shared page<br/>**`posttype`** (string, default=`link`) |
| TwitterShareButton | - | **`title`** (string): Title of the shared page<br/>**`via`**: (string)<br/>**`hashtags`** (array): Hashtags<br/>**`related`** (array): Accounts to recommend following |
| ViberShareButton | - | **`title`** (string): Title of the shared page<br/>**`separator`** (string), default=`" "`: Separates title from the url |
| VKShareButton | - | **`title`** (string): Title of the shared page<br/>**`image`** (string): An absolute link to the image that will be shared<br/>**`noParse`** (boolean): If true is passed, VK will not retrieve URL information<br/>**`noVkLinks`** (boolean): If true is passed, there will be no links to the user's profile in the open window. Only for mobile devices |
| WeiboShareButton | - | **`title`** (string): Title of the shared page<br/>**`image`** (string): An absolute link to the image that will be shared |
| WhatsappShareButton | - | **`title`** (string): Title of the shared page<br/>**`separator`** (string, default=`" "`): Separates title from the url |
| WorkplaceShareButton | - | **`quote`** (string): A quote to be shared along with the link.<br/>**`hashtag`** (string): A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. |
| EmailShareButton | - | **`subject`** (string): Title of the shared page<br/>**`body`** (string): Email, will be prepended to the url.<br/>**`separator`** (string, default=`" "`): Separates body from the url |
| FacebookShareButton | - | **`hashtag`** (string): A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. |
| FacebookMessengerShareButton | **`appId`** (string): Facebook application id | **`redirectUri`** (string): The URL to redirect to after sharing (default: the shared url).<br />**`to`** (string): A user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients. |
| HatenaShareButton | - | **`title`** (string): Title of the shared page |
| InstapaperShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page |
| LinkedinShareButton | - | **`title`** (string): Title of the shared page<br/>**`summary`** (string): Description of the shared page<br/>**`source`** (string): Source of the content (e.g. your website or application name) |
| LineShareButton | - | **`title`** (string): Title of the shared page |
| LivejournalShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page |
| MailruShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page<br/>**`imageUrl`** (string): An absolute link to the image that will be shared |
| OKShareButton | - | **`title`** (string): Title of the shared page<br/>**`description`** (string): Description of the shared page<br/>**`image`** (string): An absolute link to the image that will be shared |
| PinterestShareButton | **`media`** (string): An absolute link to the image that will be pinned | **`description`** (string): Description for the shared<br/>**`pinId`** (string): Id of existing pin - If you’ve already pinned this page, use this to treat any new Pins of this page as repins of the original. Doing this can give you a better feel for engagement, because any Pins you create will count towards repins of your original Pin. |
| PocketShareButton | - | **`title`** (string): Title of the shared page. Note that if Pocket detects a title tag on the page being saved, this parameter will be ignored and the title tag of the saved page will be used instead. |
| RedditShareButton | - | **`title`** (string): Title of the shared page |
| TelegramShareButton | - | **`title`** (string): Title of the shared page<br/> |
| TumblrShareButton | - | **`title`** (string): Title of the shared page<br/>**`tags`**: (`Array<string>`)<br/>**`caption`** (string): Description of the shared page<br/>**`posttype`** (string, default=`link`) |
| TwitterShareButton | - | **`title`** (string): Title of the shared page<br/>**`url`**: (string)<br/>**`hashtags`** (array): Hashtags<br/>**`related`** (array): Accounts to recommend following |
| ViberShareButton | - | **`title`** (string): Title of the shared page<br/>**`separator`** (string), default=`" "`: Separates title from the url |
| VKShareButton | - | **`title`** (string): Title of the shared page<br/>**`image`** (string): An absolute link to the image that will be shared<br/>**`noParse`** (boolean): If true is passed, VK will not retrieve URL information<br/>**`noVkLinks`** (boolean): If true is passed, there will be no links to the user's profile in the open window. Only for mobile devices |
| WeiboShareButton | - | **`title`** (string): Title of the shared page<br/>**`image`** (string): An absolute link to the image that will be shared |
| WhatsappShareButton | - | **`title`** (string): Title of the shared page<br/>**`separator`** (string, default=`" "`): Separates title from the url |
| WorkplaceShareButton | - | **`quote`** (string): A quote to be shared along with the link.<br/>**`hashtag`** (string): A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. |

@@ -148,3 +147,3 @@ ### Share counts

TumblrShareCount,
VKShareCount
VKShareCount,
} from "react-share";

@@ -168,3 +167,3 @@ ```

<FacebookShareCount url={shareUrl}>
{shareCount => <span className="myShareCountWrapper">{shareCount}</span>}
{(shareCount) => <span className="myShareCountWrapper">{shareCount}</span>}
</FacebookShareCount>

@@ -180,2 +179,3 @@ ```

FacebookMessengerIcon,
GabIcon,
HatenaIcon,

@@ -198,3 +198,4 @@ InstapaperIcon,

WhatsappIcon,
WorkplaceIcon
WorkplaceIcon,
XIcon,
} from "react-share";

@@ -201,0 +202,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc