Error Login Facebook React Native

0

I am having problems doing login in react-native , I followed all the corresponding steps, and at the time of logar it 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);
            }
        );

    }
    
asked by anonymous 25.02.2018 / 04:09

1 answer

0

Have 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 this should solve your problem

    
13.04.2018 / 14:13