I am using react-native-fbsdk to use Facebook APIs in my react native project. I am able to implement login/share/logout functionalities using this but till now haven't found any way to use Facebook messenger send dialog. Is there any way I can integrate FB messenger send dialog in a react native project using this?
For me, this opens the messenger send dialog (at least on iOS):
const FBSDK = require('react-native-fbsdk');
const {
MessageDialog
} = FBSDK;
........
........
........
const shareLinkContent = {
contentType: 'link',
contentUrl: 'http://xxxx',
//contentDescription: 'DONT USE ITS AGAINST FB POLICY',
};
MessageDialog.canShow(shareLinkContent).then(
function(canShow) {
if (canShow) {
return MessageDialog.show(shareLinkContent);
} else {
alert('Messenger not installed')
}
}
).then(
function(result) {
if (result.isCancelled) {
// cancelled
} else {
// success
}
},
function(error) {
showToast('Share fail with error: ' + error, 'error');
}
);
Hope it helps you!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.