首页 文章

尝试点击facebook Profiles - 做出本机反应

提问于
浏览
0

您好,我按下按钮时试图获取用户的Facebook Profiles 信息:像这样:

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

regFacebook() {
    LoginManager.logInWithReadPermissions(['public_profile']).then(
        function(result) {
            if (result.isCancelled) {
                Alert.alert(
                    "cancel",
                    "cancel"
                );
            } else {
                Alert.alert(
                    "success",
                    "success"
                );
            }
        },
        function(error) {
            Alert.alert(
                "error",
                "error"
            );
        }
    );
}

但是,当我按下它没有做任何提醒...它打开Facebook预约我给予预约但没有得到任何警报...

并在另一次点击(当有一个预约)其节目加载,而不是什么也没有提醒...

实际上我使用LoginManager而不是loginButton,因为我想要自己的按钮样式和文本...

使用react本机0.36.1和android

tnx很多

1 回答

  • 0

    嗨朋友你替换这个代码

    LoginManager.logInWithReadPermissions(['public_profile'])
            .then(function(result) {
                  if (result.isCancelled) {
                     alert('Login cancelled');
                  } else {
                     return AccessToken.getCurrentAccessToken(); //this return public profile
                  }
               },
               function(error) {
                  alert('Login fail with error: ' + error);
               }
            );
    

相关问题