如何使用Share()在react-native中共享应用程序的URL链接?

时间:2019-12-01 07:17:20

标签: react-native react-native-android share deep-linking react-native-navigation

我喜欢通过社交媒体共享应用程序链接,这样当接收者单击共享链接时,它将打开安装了共享信息的应用程序(深链接)。 请在此处找到代码:

onShare = (articleShare) => {
    try {
        const result = Share.share({
                title: articleShare.articleTitle,
                message: articleShare.articleContent,
                url:'AppName://ArticleDetail/'+articleShare._id,
            },
            {dialogTitle: 'Share Article',});
        if (result.action === Share.sharedAction) {
            Meteor.call('ShareArticleNotification', articleShare);
        };
    } catch (error) {
        alert(error.message);
    };
};

1 个答案:

答案 0 :(得分:0)

 const result = await Share.share({
        message: `https://play.google.com/store/apps/details?id=com.facebook.katana&hl=en&gl=US`,
      });