我过去常常react-native-fbsdk {ShareDialog}
在 Facebook 上发布我的提要,但ShareDialog
没有返回帖子 ID,在我的情况下它始终为空。
我的进口
import { ShareDialog, LoginManager, AccessToken, LoginButton } from "react-native-fbsdk";
这是我的代码
const shareLinkContent = {
contentType: 'link',
contentUrl: 'https://www.niofox.com/',
contentDescription: 'Test Sharing Description'
};
var tmp = this;
ShareDialog.canShow(shareLinkContent).then(
(canShow) => {
if (canShow) {
return ShareDialog.show(shareLinkContent);
}
}
).then(
(result) => {
if (result.isCancelled) {
alert('Share cancelled');
} else {
alert('Share success with postId: ' + JSON.stringify(result));
}
},
(error) => {
alert('Share fail with error: ' + error);
}
);