react-native - React Native null 不是一个对象(评估'LoginManager.logInWithPermissions')
问题描述
当我尝试登录 Facebook 时,它给了我这个错误
TypeError: null is not an object (evaluating 'LoginManager.logInWithPermissions')
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue
我这样调用函数:
import {View} from "react-native";
import React, { useState } from "react";
import {
LoginManager,
} from "react-native-fbsdk-next";
<View style={styles.horisontalView}>
<TouchableOpacity
onPress={() => {
LoginManager.logInWithPermissions([
"public_profile",
"email",
]).then(
function (result) {
if (result.isCancelled) {
console.log("Cancelado");
} else {
console.log(
"Login realizado con permisos: " +
result.grantedPermissions.toString()
);
}
},
function (error) {
console.log("Error en Login: " + error);
}
);
}}
>
</TouchableOpacity>
</View>
按照以下说明安装:https ://www.npmjs.com/package/react-native-fbsdk-next
解决方案
推荐阅读
- bash - Bash:导出 .env 变量
- messagebird - MessageBird reportUrl 未触发
- angular - 赛普拉斯使用参数测试不同页面中的相同组件
- express - 希腊语数据响应在快递中不可见
- html - 无法更改电子邮件模板 D365 crm 中的最小高度
- python - 蟒蛇硒。无法点击按钮
- python - 如何使用 at 命令进行 GPRS 互联网连接?
- excel - 在VBA中循环遍历字典时.Keys和.Keys()有什么区别
- python - Image Classifire 特征检测器
- php - 如何找到我的代码在 localhost 上运行但在 Heroku PostgreSQL 上不运行的原因?