facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

MessageDialog function is not working in iOS & Android #652

Closed bcbcbcbcbcl closed 4 years ago

bcbcbcbcbcl commented 4 years ago

🐛 Bug Report

MessageDialog.canShow promise always return false (MessageDialog is working 2 months ago)

direct call to MessageDialog.show() get error as shown in image below 72175108_314250126092834_6276229683805683712_n

Code Example

constructor(props) {
    super(props);
    const shareLinkContent = {
      contentType: 'link',
      contentUrl: 'https://facebook.com',
      contentDescription: 'Facebook sharing is easy!'
    };
    this.state = {shareLinkContent: shareLinkContent};
}

fbMessageDialog() {
    var tmp = this;
    MessageDialog.canShow(this.state.shareLinkContent).then(
      function(canShow) {
        console.log(canShow)
        if (canShow) {
          return MessageDialog.show(tmp.state.shareLinkContent);
        }  
      }
    ).then(
      function(result) {
        console.log(result)
        if (result.isCancelled) {
          alert('Share cancelled');
        } else {
          alert('Share success with postId: ' + result.postId);
        }
      },
      function(error) {
        alert('Share fail with error: ' + error);
      }
    );
  }

Environment

"react": "16.8.6", "react-native": "0.60.3", "react-native-fbsdk": "^1.0.1",

bcbcbcbcbcl commented 4 years ago

Android is working now (14/10/2019), but iOS still got the error

gmertk commented 4 years ago

Hi @bcbcbcbcbcl, Sharing to Messenger via the SDKs was deprecated a while ago. Changelog: https://developers.facebook.com/docs/messenger-platform/changelog/#20190610 Explanation in the notice card on top of https://developers.facebook.com/docs/sharing/messenger/

bcbcbcbcbcl commented 4 years ago

@gmertk Thanks for the info, really appreciate it.