Search code examples
iosfacebookreact-nativesharinguiactivityviewcontroller

React-native excludes Sharing Facebook Messenger


I use react-native-share, to share a link. It's work great with imessage & whatapps but it's crash with Facebook Messenger (I wanted to make a facebook messenger sharing but I didn't find how to do it...)

So the question is: How I can know the facebook messenger activity type ? I want to add it to this list:

excludedActivityTypes: [ 'com.linkedin.LinkedIn.ShareExtension', 'com.apple.UIKit.activity.PostToFacebook', 'UIActivityTypePostToTwitter', 'com.apple.reminders.RemindersEditorExtension', 'com.apple.mobilenotes.SharingExtension', ],

To prevent any crash from the user.

Regards, Youcef


Solution

  • The simplest way is to use web link, it simply opens the messenger app:

    Link

    <a href=”fb-messenger://share/?link=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fsharing%2Freference%2Fsend-dialog&app_id=123456789”>Send In Messenger</a>

    JavaScript

    window.open('fb-messenger://share?link=' + encodeURIComponent(link) + '&app_id=' + encodeURIComponent(app_id));

    reference: https://developers.facebook.com/docs/sharing/messenger/web