olahol / react-social Goto Github PK
View Code? Open in Web Editor NEWSimple React components for social buttons (Facebook, Twitter and Pinterest) and social counts.
Simple React components for social buttons (Facebook, Twitter and Pinterest) and social counts.
I don't know why but it seems that I can't get the google url to work when the url parameter is encoded.
Check for yourself:
Unfortunatly as the lib encodes the url, I'm in the case where it does not work.
Am I the only one having this problem?
The message prop seems to work on Twitter but not Facebook. Any advice?
<FacebookButton appId="..........." url="www.google.com" message='Message goes here'>
<TwitterButton url="www.google.com" message='Message goes here'>
drop warning that sharer is unknown prop
import ReactSocial from 'react-social';
const { FacebookButton, TwitterButton } = ReactSocial;
<FacebookButton
element={'span'}
url={url}
sharer
className={s.fb}
appId={sharing.facebook.app_id}
windowOptions={['status=0', 'toolbar=0', 'width=480', 'height=350']}
>
warning.js:36 Warning: Unknown prop sharer
on tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
I want to use this library as my main social sharing but what I want to share outside of the url and an image url, I also want to share a blob or a HTML5 canvas dataUrI to facebook or whatever social network? Just curious if it is possible using this library?
How to get Likes Count at Facebook Page?
warning.js:45 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the undefined component.
warning @ warning.js:45
getInternalInstanceReadyForUpdate @ ReactUpdateQueue.js:34
ReactUpdateQueue.enqueueSetState @ ReactUpdateQueue.js:181
ReactComponent.setState @ ReactComponent.js:65
(anonymous function) @ react-social.js:143
(anonymous function) @ ?callback=jsonp_1463407624090_466&url=http%3A%2F%2F127.0.0.1%3A3000%2Fpagina%2Fcronologia-dos-acont…:1
i got this error when use it : Cannot read property 'matches' of null.
How can i fixed it? thanks.
I think of a ButtonGroup component that is capable of displaying all the buttons you want with just one single component. Because usually you want to share the same url with the same message at one time. So what you basically can do with a button group would be something like that:
render() {
const url = "https://github.com/olahol/react-socia", message = "So cool!";
const buttonsToShow = [{
button: 'Facebook',
style: BUTTON_WITH_COUNTER,
appId: 'my-facebook-app-id'
}, {
button: 'Google',
style: BUTTON_WITHOUT_COUNTER
}, {
button: 'Reddit'
}
];
return (
<div className="btn-group">
<ButtonGroup url={url} message={message} buttons={buttonsToShow} />
</div>
)
}
url and message are directly passed down to every button props since it is always the same. appId is only passed if available and needed. And there can be a button style that can display a button itself or one with a couter.
What do you guys think of that approach?
Hello! Great Repo!
I`m need a buttons:
So, later i'd try fork and realise it.
We regret to inform you that due to a massive rise in popularity of our service we've had to implement a rate limit of 1000 API requests per hour. If you require more requests please contact us to discuss premium or dedicated options.
In most cases, this is not a problem.. but an issue.
I tried feeding the share buttons a React component (a custom button) rather than just the string name of a html tag.
It works perfectly. props get passed down and the component gets rendered nicely.
However react raised a PropType warning, since the validation requires a string.
warning.js:45 Warning: Failed propType: Invalid prop `element` of type `function` supplied to `FacebookButton`, expected `string`.
This should be easy to fix by adding function to the possible PropTypes.
What do you think about integrating Whatsapp? I can make a PR :)
How about structuring the components into separate files?
I'd go with this directory structure:
- index.js
- lib
| jsonp.js
| - Components
| | - Facebook
| | | - FacebookButton
| | | | - facebookbutton.js
| | | | - index.js
| | | - FacebookCount
| | | | - facebookcount.js
| | | | - index.js
| | - Xing
| | | - XingButton
| | | | - xingbutton.js
| | | | - index.js
.. and so on. What do you think?
The more buttons and functions, the more unmaintainable it will be with one single file in future.
It would also be nice to have different example styles for the buttons (with optional FontAwesome icons for instance). This would lead to an easier integration for new react users.
I'd also propose to switch to ES6 syntax in that step.
I don't why i can't use it
Is there place that i can check my quota
If i do over the limit of request where i can upgrade my account
Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class
Had this error with react 15.0.1
React.__spread is deprecated and should not be used. Use Object.assign directly or another helper function with similar semantics. You may be seeing this warning due to your compiler. See https://fb.me/react-spread-deprecation for more details.
Hi,
Is it possible to pass a prop target to define target type. I want pop up instead of new window.
I saw on the code here
if (typeof result === "object") { var url = result[0] var target = result[1] } else { var url = result var target = "_blank" } window.open(url, target);
Thanks
When following the example using React 15, I'm getting this error message:
Unknown props
message',
appId,
_open` on tag. Remove these props from the element.
Facebook count not working.
I think need to use https://graph.facebook.com/?id=
not api.facebook.com
Redirecting to https://plus.google.com/up/error/?etype=ad and it is show the error that The requested URL was not found on this server
React-social is a good package.
I think you should implement prop isPopup, and if isPopup == true, then open new popup window instead open new tab.
Example: http://www.rapidtables.com/web/html/link/html-link-new-window.htm
It seems the app_id is hardcoded:
Line 249 in f4fd7c3
From what I've read, this should be set per app, not hardcoded.
Just an idea,
We can use this source to integrate more platforms. https://github.com/esvit/angular-social/tree/master/src/scripts
I am going to work on google plus and share when i have done
when i pass the url of media it does'nt show media on shared post on facebook.
<FacebookButton
url={location}
appId={facebookAppId}
title={data.SingleCampaign ? data && data.SingleCampaign.Name : ""}
message={data.SingleCampaign ? data && data.SingleCampaign.Description : ""}
media={"https://s3.ap-south-1.amazonaws.com/isupportcause/uploads/campaign/banner/isupportimg_1585918590583.jpeg"}
>
Hi,
var msg = this.props.message === "" ?
this.props.url : this.props.message + " " + this.props.url;
The url is shortened by twitter automatically and the size is always 23, so it makes sense to automatically truncate the message with a limit of (140 - 24) I think
Hi,
It seems it's possible to share to pocket and have a count.
I've also seen donreach supports a count for pocket.
https://getpocket.com/publisher/button
It would be nice to support Pocket as well
Receiving an error for url
when not provided.
Warning: Failed propType: Invalid prop `url` of type `object` supplied to `MyComponent`, expected `string`.
Consider window.location.href
:
https://github.com/olahol/react-social/blob/master/react-social.js#L87
Hi man,
thank you for this component! But, how works the Media for FB and TW?
If I'm trying something like this:
var media = "http://someUrl.com/imageName.png";
...
<FacebookButton url={url} media={media}>
FB share
</FacebookButton>
nothing happen there. Can you help me, how include the image there? Thank you!
V.
I chose to use this package because when I originally went through the example and implemented it, it just worked (for facebook and twitter). Now however, it is acting like it expects and facebook app id. Does this require an app id? If so, why no mention in example. If not, why am I getting the error?
Hi there,
after a 2 minute investigation (i.e. plz take this with a grain of salt), it seems to me that react-social is incompatible with React 16 because it uses the deprecated React.createClass
https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html
cheers
JL
Hi, how are you.
I´m having some trouble using this component with React.renderToString.
I get this error:
error: uncaughtException: react-social uses jsonp and requires a browser environment
from this line i guess:
[...]
if (typeof document === "undefined" || typeof window === "undefined") {
throw new Error("react-social uses jsonp and requires a browser environment");
}
[...]
Is there a way to get this working?
Thanks!
Hi, just tried using the TwitterButton component and it works fine on desktop browsers, however I see that on a iPhone it directs to a mobile.twitter.com side with the embedded message in the URL, but all I see on the phone is the Twitter Home page with the list of Tweets on the account. No compose tweet UI pops up like on Desktop.
Is this a known issue?
I can't create an account on the website. I end up on cloudflare with a server unreachable message.
Twitter share counts are gone, they need to be added back.
Hi,
I'm not sure it's even permitted by Instagram, but is there a way to share a picture to Instagram, like for Pinterest? If so it would be nice to have it
This is not a bug, but it would be useful to have a screenshot of how this component looks
The only disadvantage is that its is not possible to catch the hook when user sucessfully shares(e.g. to close modal, to make a discount...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.