I copied the example exactly from the facebook example at https://developers.facebook.com/docs/react-native/sharing .
The problem is that when I hit the function i get undefined is not an object (evaluating 'ShareDialog.canShow' . I know it is referring to the ShareDialog object.
I am importing it using the line
import {ShareDialog} from 'react-native-fbsdk';
The code for my function is:
shareOnFacebook () {
var tmp = this;
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);
}
);
}