I have an app built in react-native in which I need to share a post on LinkedIn with predefined content.
I used 'react-native-share' for sharing content on LinkedIn but It's not working. How can I achieve this?
LinkedIn supports only one parameter being passed to it, and that is the url parameter. It will look like this...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Source: Official LinkedIn Sharing Documentation.
The following parameters will not work: summary, title, source, etc.. Anything besides url.
To share to LinkedIn, just make a <a href> element that points to an above formatted-URL, and make absolutely sure to do URL-encoding on your {url}.
You probably want to share title and summary, though, based on the accepted answer. You cannot do that using GET-data, BUT you can do that using og: tags.
<meta property='og:title' content='Title of the article"/><meta property='og:image' content='//media.example.com/ 1234567.jpg"/><meta property='og:description' content='Description that will show in the preview"/><meta property='og:url' content='//www.example.com/URL of the article" />Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.
In case you are uncertain that you've followed the LinkedIn documentation correctly to make a share URL, you can test your page's URL to see how it will look when shared here: LinkedIn Post Inspector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With