In the facebook iOS SDK, there is a module called App Invites, allowing to send invites to your app to your friends (https://developers.facebook.com/docs/ios/).
This module does not seem to exist for React Native apps (https://developers.facebook.com/docs/react-native) does anyone know a workaround to make it work?
Many thanks.
I actually found how to do it digging in react-native-fbsdk.
There is a class called AppInviteDialog that you can use like the ShareDialog described here: 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);
}
);
}
...
});
Happy discovery ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With