1
votes

I'm using react-native for facebook log in. As you can see on the following link, i have some problem with the facebook login render:

enter image description here

To get that, first i did : rnpm install react-native-fbsdk (to install facebook dependencies).

Then I added the basics facebook code tutorial (https://developers.facebook.com/docs/react-native/login) :

const FBSDK = require('react-native-fbsdk');
const {
    LoginButton,
} = FBSDK;

var Login = React.createClass({
    render: function() {
        return (
            <View>
                <LoginButton
                    publishPermissions={["publish_actions"]}
                    onLoginFinished={
                        (error, result) => {
                            if (error) {
                                alert("Login failed with error: " + result.error);
                            } else if (result.isCancelled) {
                                alert("Login was cancelled");
                            } else {
                                alert("Login was successful with permissions: " + result.grantedPermissions)
                            }
                        }
                    }
                    onLogoutFinished={() => alert("User logged out")}/>
            </View>
        );
    }
});

Finally I added my Facebook API Key in the android manifest like that : (meta-data) android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>

Do you have any idea to solve this problem ? Thanks a lot for your answers !

1

1 Answers

0
votes

I found the solution...

The problem was coming from MainApplication.java and MainActivity.java (in android/app).

Facebook's documentation is out of date... (only available for react-native version < 0.29...).