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



我正在尝试遵循此处的指南:https://developers.facebook.com/docs/react-native/login让脸书登录在我的应用程序上工作。我从字面上复制并粘贴了简单版本到这样的文件中:

    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:模块映射或以下目录中不存在:{项目}/node_modules

关于如何进行的任何想法?

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

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

$npm安装 --保存道具类型

PropType 现在是一个单独的模块,不再包含在 react 中。这是链接:https://www.npmjs.com/package/prop-types

详细信息: https://github.com/GeekyAnts/NativeBase/issues/861

最新更新