I am using react-native-fbsdk 0.4.0 and followed the steps from https://github.com/facebook/react-native-fbsdk. I have tried the native Object-C testing app after adding the native FBSDK and the FB login button works without problems.
However, I got the same issue as this post React Native Facebook Login using official fbsdk.
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
const FBSDK = require('react-native-fbsdk');
const {
LoginButton,
AccessToken
} = FBSDK;
var Login = React.createClass({
render: function() {
return (
<View>
<LoginButton
publishPermissions={["publish_actions"]}
onLoginFinished={
(error, result) => {
if (error) {
alert("login has error: " + result.error);
} else if (result.isCancelled) {
alert("login is cancelled.");
} else {
AccessToken.getCurrentAccessToken().then(
(data) => {
alert(data.accessToken.toString())
}
)
}
}
}
onLogoutFinished={() => alert("logout.")}/>
</View>
);
}
});
AppRegistry.registerComponent('fbsdk_rn', () => Login);
Really appreciate any help. Thanks.
UPDATE: just fix my problem and hope can inspire someone else. I check this 'react-native-facebook-login' from https://github.com/magus/react-native-facebook-login.
The whole procedure is almost same except there is one different "header file import" in "AppDelegate.m"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
I add the second import of FBSDKLoginKit.h and it works.
I am using this code in my case the Login Button work well and if you can use this code i am sure your button are work properly...
See the code here....
And the App.js file are here