简体   繁体   English

正确地将fbsdk集成在react-native中

[英]Integrate fbsdk in react-native correctly

Its been 2 days I have been trying to incorporate react-native-fbsdk into my react-native project; 已经有两天了,我一直在努力将react-native-fbsdk整合到我的反应原生项目中; but have had no luck. 但没有运气。 Have gone through and followed most of the tutorials on the internet(including those provided by Facebook: https://developers.facebook.com/quickstarts/ ) , but nothing seems to work. 已经完成并遵循了互联网上的大部分教程(包括Facebook提供的那些教程: https//developers.facebook.com/quickstarts/ ),但似乎没有任何效果。 Best I have got is a rectangle with red border(which should have been "Login With Facebook") 我最好的是一个带红色边框的矩形(应该是“登录Facebook”)

I have started just 2 days ago so everything I am working on is up-to-date. 我刚刚开始工作2天,所以我所做的一切都是最新的。 I have also installed 'rnpm' for linking module to native apps. 我还安装了'rnpm'来将模块链接到本机应用程序。

Here is the package.json: 这是package.json:

    {
      "name": "bas",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
      },
      "dependencies": {
        "react": "~15.4.0-rc.4",
        "react-native": "0.40.0",
        "react-native-fbsdk": "^0.4.0"
      },
      "devDependencies": {
        "babel-jest": "18.0.0",
        "babel-preset-react-native": "1.9.1",
        "jest": "18.1.0",
        "react-test-renderer": "~15.4.0-rc.4"
      },
      "jest": {
        "preset": "react-native"
      }
    }

Sorry if I seem dumb anywhere; 对不起,如果我在任何地方显得愚 have just started mobile app development; 刚刚开始移动应用程序开发; I come from web development background. 我来自网站开发背景。

Thanks in advance! 提前致谢!

I cannot take credit for this answer - but after some digging it appears that the issue was introduced in react-native v0.40.0 . 我不能react-native v0.40.0这个答案 - 但经过一些挖掘后,似乎问题是在react-native v0.40.0 Unfortunately many libraries are not yet updated to work with these changes. 遗憾的是,许多库尚未更新以使用这些更改。

Lucky for us, react-native-fbsdk does support it, but it unfortunately it hasn't been formally released yet. 幸运的是,react-native-fbsdk确实支持它,但不幸的是它还没有正式发布。

You can use the latest version (with the fix) by directly from github. 您可以直接从github使用最新版本(带修复程序)。 Follow the steps here: https://github.com/facebook/react-native-fbsdk/pull/322#issuecomment-271457311 请按照此处的步骤操作: https//github.com/facebook/react-native-fbsdk/pull/322#issuecomment-271457311

This worked for me! 这对我有用! Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM