Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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: enter image description here

Share does not have text in Facebook (only URL): enter image description here

like image 700
vijayst Avatar asked Jan 03 '23 17:01

vijayst


1 Answers

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.

like image 112
eden Avatar answered Jan 06 '23 05:01

eden