Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
outpost-react-share
Advanced tools
A fork of react-share that allows share windows to open in a new tab. I'm publishing this module while I'm waiting for react-share to accept my pull request.
Social media share buttons and share counts for React.
Migrating from v2 to v3? Read changelog.
Migrating from v1 to v2? Read migration notes.
To run demo: clone repo and run npm install && npm run run-demos
and open http://localhost:8080
.
npm install react-share --save
Version 1.x.x: compatible with React versions 0.13.x
, 0.14.x
and 15.x.x
.
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.
import {
EmailShareButton,
FacebookShareButton,
InstapaperShareButton,
LineShareButton,
LinkedinShareButton,
LivejournalShareButton,
MailruShareButton,
OKShareButton,
PinterestShareButton,
PocketShareButton,
RedditShareButton,
TelegramShareButton,
TumblrShareButton,
TwitterShareButton,
ViberShareButton,
VKShareButton,
WhatsappShareButton,
WorkplaceShareButton
} from "react-share";
Required props | Optional props | |
---|---|---|
All | children (string/element): React nodeurl (string): URL of the shared page | disabled (bool): Disables click action and adds "disabled" classdisabledStyle (object, default={ opacity: 0.6 } ): Disabled stylewindowWidth , windowHeight (number, different default for all share buttons): opened window dimensionsbeforeOnClick (() => 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.openShareDialogOnClick (boolean): Open dialog on click. Defaults to true except on EmailShareButtononShareWindowClose (() => void ): Takes a function to be called after closing share dialog.resetButtonStyle (boolean, default=true ): Reset button element style. Preferred to be set to false if you want to customize the button style.hasBlankTarget (boolean, default=false ): Open up share window in a new tab if set to true . |
EmailShareButton | - | subject (string): Title of the shared pagebody (string): Email, will be prepended to the url.separator (string, default=" " ): Separates body from the url |
FacebookShareButton | - | quote (string): A quote to be shared along with the link.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).to (string): A user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients. |
InstapaperShareButton | - | title (string): Title of the shared pagedescription (string): Description of the shared page |
LinkedinShareButton | - | title (string): Title of the shared pagesummary (string): Description of the shared pagesource (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 pagedescription (string): Description of the shared page |
MailruShareButton | - | title (string): Title of the shared pagedescription (string): Description of the shared pageimageUrl (string): An absolute link to the image that will be shared |
OKShareButton | - | title (string): Title of the shared pagedescription (string): Description of the shared pageimage (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 |
TumblrShareButton | - | title (string): Title of the shared pagetags : (Array<string> )caption (string): Description of the shared pageposttype (string, default=link ) |
TwitterShareButton | - | title (string): Title of the shared pagevia : (string)hashtags (array): Hashtagsrelated (array): Accounts to recommend following |
ViberShareButton | - | title (string): Title of the shared pageseparator (string), default=" " : Separates title from the url |
VKShareButton | - | title (string): Title of the shared pageimage (string): An absolute link to the image that will be sharednoParse (boolean): If true is passed, VK will not retrieve URL informationnoVkLinks (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 pageimage (string): An absolute link to the image that will be shared |
WhatsappShareButton | - | title (string): Title of the shared pageseparator (string, default=" " ): Separates title from the url |
WorkplaceShareButton | - | quote (string): A quote to be shared along with the link.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. |
import {
FacebookShareCount,
OKShareCount,
PinterestShareCount,
RedditShareCount,
TumblrShareCount,
VKShareCount
} from "react-share";
All share count components take in only one mandatory prop: url
, which is the
URL you are sharing. className
prop is optional.
Example:
<FacebookShareCount url={shareUrl} />
If you want to render anything else but the count,
you can provide a function as a child element that takes in shareCount
as an
argument and returns an element:
<FacebookShareCount url={shareUrl}>
{shareCount => <span className="myShareCountWrapper">{shareCount}</span>}
</FacebookShareCount>
import {
EmailIcon,
FacebookIcon,
FacebookMessengerIcon,
InstapaperIcon,
LineIcon,
LinkedinIcon,
LivejournalIcon,
MailruIcon,
OKIcon,
PinterestIcon,
PocketIcon,
RedditIcon,
TelegramIcon,
TumblrIcon,
TwitterIcon,
ViberIcon,
VKIcon,
WeiboIcon,
WhatsappIcon,
WorkplaceIcon
} from "react-share";
Props:
size
: Icon size in pixels (number)
round
: Whether to show round or rect icons (bool)
borderRadius
: Allow rounded corners if using rect icons (number)
bgStyle
: customize background style, e.g. fill
(object)
iconFillColor
: customize icon fill color (string, default = 'white')
Example:
<TwitterIcon size={32} round={true} />
This library uses the standard semver convention. However, the share buttons and and counts are prone to lots of changes that are not in control of this library. For example: if Facebook decides to change or deprecate it's API in a major way, this library will not get a major version bump just because of that. Keep this in mind when you are planning the maintenance of your application.
MIT
Icon paths provided by: react-social-icons.
FAQs
Social media share buttons and share counts for React.
We found that outpost-react-share demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.