screen shot of error React Native:
使用fbsdk时可能出现未处理的承诺拒绝
显示出上述错误的黄色屏幕。我尝试了很多调试这个,但dint工作很友好请帮我调试这个错误。
我的代码:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
} from 'react-native';
import FBSDK, { LoginManager } from 'react-native-fbsdk'
export default class fbappss extends Component {
_fbAuth(){
LoginManager.logInWithReadPermissions(['public_profile']).then(function(result){
if (result.isCancelled) {
console.log('Login was cancelled');
} else {
console.log('Login was a success' + result.grantedPermission.toString());
}
}, function(error) {
console.log('an error occured:' +error);
})
}
render() {
return (
<View>
<TouchableOpacity onPress={this._fbAuth()}>
<Text>facebook</Text>
</TouchableOpacity>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('fbappss', () => fbappss);
答案 0 :(得分:0)
您可以发布错误页面
将FDSDK放在正确的位置后尝试重建项目