2017-07-04 32 views
0

screen shot of error陣營原生。我試了很多來調試這個,但dint工作好心請幫我調試這個錯誤。可能未處理無極抑制(ID:0):在使用fbsdk</p> </blockquote> <p>它顯示一個黃色畫面上述錯誤</p> <blockquote> <p>可能的未處理的承諾排斥:在使用Facebook的SDK

我的代碼:

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

後._fbAuth()}否則它將在渲染時執行。 – chetan

回答

0

你能發表您的錯誤頁面

嘗試重建項目上應該這樣寫onPress = {()=>這將FDSDK在正確的地方

相關問題