react-native - 使用 React Native 在 LinkedIn 上分享帖子

标签 react-native linkedin

我有一个内置于 react-native 的应用程序,我需要在其中分享带有预定义内容的 LinkedIn 帖子。

我使用“react-native-share”在 LinkedIn 上分享内容,但它不起作用。我怎样才能做到这一点?

提前致谢。

最佳答案

LinkedIn 只支持向其传递一个参数,即 url 参数。它看起来像这样......

https://www.linkedin.com/sharing/share-offsite/?url={url}

来源:Official LinkedIn Sharing Documentation

以下参数将不起作用:summarytitlesource 等。除 url 之外的任何参数。

要分享到 LinkedIn,只需创建一个指向上述格式化 URL 的 <a href> 元素,并绝对确保对您的 {url} 进行 URL 编码。

不过,根据已接受的答案,您可能想分享 titlesummary 。您不能使用 GET -data 来做到这一点,但是您可以使用 og: 标签来做到这一点。

  • <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" />

来源:LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn

如果您不确定自己是否按照 LinkedIn 文档正确创建了共享 URL,您可以在此处测试页面的 URL 以查看共享时的外观: LinkedIn Post Inspector

关于react-native - 使用 React Native 在 LinkedIn 上分享帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61076706/

相关文章:

javascript - 如何使用 React Native 设置 Sublime 3,以便当您单击错误并跳转到您的代码时?

css - 如何在 React Native 中使文本在图像周围 float

ios - 如何在 iOS 上禁用 firestore 的持久性(缓存)

api - 是否可以通过 LinkedIn API 接收职位申请?

oauth - LinkedIn OAuth 异常范围 NOT_AUTHORIZED r_fullprofile

react-native - 将 screenProps 传递给选项卡导航器

seo - 开放图描述元标记在 LinkedIn 中不起作用

java - scribe 1.3 share request to linkedin API return a 401 - unauthorized

javascript - 使用 LinkedIn 分享按钮添加标题和描述

javascript - 播放 Dash 或 .mpd 视频 React-native(IOS)