Problems logging into Facebook using React-native

I try to follow the guide here: https://developers.facebook.com/docs/react-native/login to login to facebook working in my application. I literally copied and pasted a 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, we get the following error on the ios simulator:

Cannot resolve the module prop-typesfrom {redacted}/node_modules/react-native-fbsdk/js/FBLikeView.js: the module does not exist in the module map or in these directories: {Project} / node_modules

Any ideas on how to proceed?

I tried reinstalling the node modules and flushing the cache, but I seem to be locked.

+4
source share
2

, prop-types:

$npm install --save prop-types

+4

Source: https://habr.com/ru/post/1678031/


All Articles