使用React-native实现Facebook登录的问题

问题描述:

我想要按照这里的指南: https://developers.facebook.com/docs/react-native/login 要获取Facebook登录工作在我的应用程序。我从字面上复制并粘贴简单的版本为这样的文件:使用React-native实现Facebook登录的问题

import React, { Component } from 'react'; 
import{ 
    View 
} from 'react-native'; 

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

var Login = React.createClass({ 
    render: function() { 
    return (
     <View> 
     <LoginButton 
      publishPermissions={['publish_actions']} 
      onLoginFinished={ 
      (error, result) => { 
       if (error) { 
       alert('Login failed with error: ' + result.error); 
       } else if (result.isCancelled) { 
       alert('Login was cancelled'); 
       } else { 
       alert('Login was successful with permissions:' + result.grantedPermissions) 
       } 
      } 
      } 
      onLogoutFinished={() => alert('User logged out')}/> 
     </View> 
    ); 
    } 
}); 
export default class FacebookLogin extends Component { 
render(){ 
    return (
    <Login /> 
); 
} 

} 

但是收到在iOS模拟器以下错误:

无法从{redacted}/node_modules/react-native-fbsdk/js/FBLikeView.js解析模块prop-types:模块中不存在模块映射或在这些目录中: {project}/node_modules

有关如何继续的任何想法?

我试着重新安装节点模块并重置缓存,但我似乎被阻止。

PropTypes现在是一个单独的模块,不再包含在反应中。 Here's链接:https://www.npmjs.com/package/prop-types

的更多信息:https://github.com/GeekyAnts/NativeBase/issues/861

我能够通过安装道具类型,以解决此问题:

$ NPM安装--save道具类型

+0

像工作魅力!感谢队友 –

+0

它也适用于我。谢谢! –