[英]Issues implementing Facebook login with React-native
I am trying to follow the guide here: https://developers.facebook.com/docs/react-native/login to get facebook login working on my app. 我试图按照这里的指南: https : //developers.facebook.com/docs/react-native/login来获取facebook登录我的应用程序。 I have literally copied and pasted the simple version into a file like this:
我已经将简单版本复制并粘贴到这样的文件中:
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 />
);
}
}
However recieve the following error on the ios simulator: 但是在ios模拟器上收到以下错误:
Unable to resolve module prop-types
from {redacted}/node_modules/react-native-fbsdk/js/FBLikeView.js
: Module does not exist in the module map or in these directories: {project}/node_modules 无法从
{redacted}/node_modules/react-native-fbsdk/js/FBLikeView.js
解析模块prop-types
:模块映射或这些目录中不存在模块:{project} / node_modules
Any ideas on how to proceed? 关于如何进行的任何想法?
I tried reinstalling node modules and resetting the cache but I seem blocked. 我尝试重新安装节点模块并重置缓存但我似乎被阻止了。
I was able to resolve this by installing prop-types: 我能够通过安装prop-types来解决这个问题:
$npm install --save prop-types $ npm install --save prop-types
PropTypes is a separate module now, and not included in react anymore. PropTypes现在是一个单独的模块,不再包含在反应中。 Here´s the link: https://www.npmjs.com/package/prop-types
这是链接: https ://www.npmjs.com/package/prop-types
More information: https://github.com/GeekyAnts/NativeBase/issues/861 更多信息: https : //github.com/GeekyAnts/NativeBase/issues/861
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.