Error Login Facebook React Native

Asked

Viewed 222 times

0

I’m having trouble doing login in the react-native, I followed all the corresponding steps, and at the time of logar presents the following error

cannot read property 'logInWithReadPermissions' of undefined

import FBDSK, { LoginManager } from 'react-native-fbsdk'

_fbAuth() {

        LoginManager.logInWithReadPermissions(['public_profile', 'email']).then(
            function(result) {
                if (result.isCancelled) {
                    alert('Login cancelled');
                } else {
                    alert('Login success with permissions: ' +
                        result.grantedPermissions.toString());
                }
            },
            function(error) {
                alert('Login fail with error: ' + error);
            }
        );

    }

1 answer

0

You tried to set the Login environment?

Example:

LoginManager.setLoginBehavior(LoginManager.LoginBehaviors.Native); LoginManager.logInWithReadPermissions(['public_profile', 'email']).then( function(result) { if (result.isCancelled) { alert('Login cancelled'); } else { alert('Login success with permissions: ' + result.grantedPermissions.toString()); } }, function(error) { alert('Login fail with error: ' + error); } );

I think that should solve your problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.