I'm trying to get a list of posts from a Facebook page, but when I send my request via GraphRequestManager, it throws an error "undefined is not an object (evaluating 'NativeGraphRequestManager.start'). I've correctly linked FBSDK with my project and I'm using Android to test, and I followed the React Native guide for FBSDK but it still throws an error. Any ideas? Using RN 0.47 and FBSDK 0.6.1.
Here is a snippet of my code:
const FBSDK = require('react-native-fbsdk');
const {
GraphRequest,
GraphRequestManager,
} = FBSDK;
export default class FeedView extends Component {
constructor(props) {
super(props);
this.state = {
posts: null,
}
}
componentDidMount() {
this.setState({
refreshing: false,
posts: this._getPosts(),
});
}
_getPosts() {
const getRequestConfig = {
httpMethod: 'GET',
version: 'v2.10',
parameters: null,
accessToken: accessToken,
}
const infoRequest = new GraphRequest(
page,
getRequestConfig,
this._responseInfoCallback,
);
new GraphRequestManager().addRequest(infoRequest).start();
}
_responseInfoCallback(error, result) {
if (error) {
alert('Error fetching data: ' + error.toString());
} else {
alert('Success fetching data: ' + result.toString());
console.log(result.toString());
}
}