使用React Native在LinkedIn上分享帖子

问题描述 投票:0回答:2

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

我使用'react-native-share'在LinkedIn上共享内容,但不起作用。我该如何实现?

提前感谢。

react-native linkedin
2个回答
0
投票

您可以用react-native-share完成。我已经在我的一个应用程序中使用过它。

const shareOptions = {
  title: 'Share via',
  message: `Hello,  ${description}`,
  subject: 'Subject,
  url: "data:image/png;base64," + base64Data,
  showAppsToView: false,
  filename: 'test',
};
Share.open(shareOptions).then(res => {
  console.log(res)
}).catch(e => {
  console.log(e)
});

:如果您可以共享代码,那就更好了。


0
投票

您可以使用来自本机的链接

import { Linking } from 'react-native';

然后您可以使用

Linking.openURL("https://www.linkedin.com/shareArticle?mini=true&summary=youtube&title=f1&url=https://www.youtube.com/watch?v=dQw4w9WgXcQ");

您可以在此处找到更多信息https://stackoverflow.com/a/10737122/6125249

© www.soinside.com 2019 - 2024. All rights reserved.