简体   繁体   中英

Share API does not share message with Facebook

I am using Share API in React native as follows.

handleSharePress() {
        Share.share({ 
            message: `I scored ${this.score}% in React Quiz: https://play.google.com/store/apps/details?id=com.vijayt.reactquiz`
        }, {
            dialogTitle: 'Share my score'
        });
    }

The Share works fine in Android with Twitter. But with Facebook, I am not seeing the message text in the share.

Share has text in Twitter: 在此处输入图片说明

Share does not have text in Facebook (only URL): 在此处输入图片说明

This is because Facebook doesn't let you do so. According to their Platform Policy 2.3, you can't pre-fill text to your sharing dialogs, all content must be entered by the user :

Pre-fill the user message parameter with any content the user didn't enter themselves, even if they can edit or delete that content before sharing. This applies to posts, comments, photo captions, and photo album captions.

Source: https://developers.facebook.com/docs/apps/review/prefill

I guess to add this functionality you need to include Facebook SDK and perform login before sharing. You can use this library or implement the SDK yourself through official documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM