2016-08-18 166 views

回答

14

我實際上發現如何在react-native-fbsdk中挖掘它。

這裏有描述一個名爲AppInviteDialog類,您可以使用像ShareDialog:https://developers.facebook.com/docs/react-native/sharing

const FBSDK = require('react-native-fbsdk'); 
const { 
    AppInviteDialog, 
} = FBSDK; 


module.exports = React.createClass({ 
    getInitialState: function() { 

     return { 
      appInviteContent: { 
      applinkUrl: 'https://yourapplink.com', 
      } 
     } 
    }, 

    shareLink: function() { 
     var tmp = this; 
     AppInviteDialog.canShow(this.state.appInviteContent).then(
      function(canShow) { 
       if (canShow) { 
        return AppInviteDialog.show(tmp.state.appInviteContent); 
       } 
      } 
     ).then(
      function(result) { 
       if (result.isCancelled) { 
        alert('Share operation was cancelled'); 
       } else { 
        alert('Share was successful with postId: ' + result.postId); 
       } 
      }, 
      function(error) { 
       alert('Share failed with error: ' + error); 
      } 
     ); 
    } 
    ... 
}); 

快樂的發現;)

相關問題