React Native无法启动

时间:2018-08-03 08:58:58

标签: reactjs firebase react-native react-native-firebase

我是React Native的新手。我使用了React Native Firebase starter kit并遵循了所有步骤,但是一旦我想开始,它就会卡在该屏幕上: enter image description here 有没有人经历过或知道如何解决此问题?

更新:运行npm run iOS时出现以下错误: enter image description here

Package.json

的内容
{
  "name": "ReactNativeStarter",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-install": "2.1.0",
    "babel-jest": "^23.4.0",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "fs-extra": "^6.0.1",
    "jest": "^23.4.0",
    "react-test-renderer": "^16.4.1",
    "replace-in-file": "^3.4.0"
  },
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "rename": "node ./bin/rename.js",
    "start": "react-native start",
    "test": "jest"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "fbjs": "^0.8.17",
    "react": "^16.3.2",
    "react-native": "^0.56.0",
    "react-native-firebase": "^4.3.6"
  }
}


.babelrc

的内容
{
  "presets": [
    "babel-preset-react-native-stage-0/decorator-support"
  ],
  "env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source"
      ]
    }
  }
}

1 个答案:

答案 0 :(得分:0)

像Babel这样的外观需要升级。

  

升级到0.56时,请确保将babel-preset-react-native package.json依赖项提高到^ 5.0.1或更高版本。

但是,您正在使用babel-preset-react-native-stage-0,它似乎不支持React Native 0.56.0。参见https://github.com/skevy/babel-preset-react-native-stage-0/issues/8

我的建议是尝试使用babel-preset-react-native,直到发布针对babel-preset-react-native-stage-0的修复程序。