I am using react-native-fbsdk in my RN app (version "react-native-fbsdk": "^0.10.1",) I am using ShareDialog.show
method and getting callback and check result, Everything was working fine but when I install FB application and try to share via FB app then getting empty callback result with promise (Either I share or cancel the post). So, I tried with many ways the result is same.
Below is my code
shareLinkWithShareDialog() {
var tmp = this;
// If remove below line the code work with in app dialog
ShareDialog.setMode('native');
ShareDialog.canShow(this.state.shareLinkContent).then(
function(canShow) {
if (canShow) {
return ShareDialog.show(tmp.state.shareLinkContent);
}
}
).then(
function(result) {
if (result.isCancelled) {
alert('Share cancelled');
} else {
alert('Share success with postId: ' + result.postId);
}
},
function(error) {
alert('Share fail with error: ' + error);
}
);
}
So, My question is, How can I get result as I was getting with in-app dialog (When not using ShareDialog.setMode('native');
line.
UPDATE QUESTION:
Now I am getting callback but always {isCancelled: true}
. I just update the AppDelegate method and use return [RCTLinkingManager application:application openURL:url options:options]
instant of return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:nil]
.