React Native UWP(vnext)-导入react-navigation-stack会导致错误:“无法读取未定义的属性'Direction'”

时间:2019-11-22 22:07:19

标签: react-native uwp react-native-windows

我目前正在研究一个简单的“ hello-world”类型的项目,直到我在import { createStackNavigator } from 'react-navigation-stack';中使用App.js为止,它在Android和UWP上都可以正常工作。该应用程序仍可在Android上运行,但在UWP中,应用程序屏幕只是白色,而Chrome调试器会向我显示以下错误消息:

...\ReactNative\MyApp_ReactNative\node_modules\react-native-windows\Libraries\Core\ExceptionsManager.js:86 Cannot read property 'Direction' of undefined

...\MyApp_ReactNative\node_modules\react-native-windows\Libraries\Core\ExceptionsManager.js:86 Module AppRegistry is not a registered callable module (calling runApplication)

我已经为这个问题苦苦挣扎了好几天,而我根本找不到任何解决方案。我怀疑react-native-windows的vnext版本不支持react-navigation-stack,或者可能是我需要使用以前版本的react-navigation-stack与UWP一起使用。

我对React和React Native完全陌生,所以请保持一些简单的解释?。要进行复制,请遵循本指南https://github.com/microsoft/react-native-windows/blob/master/vnext/docs/GettingStarted.md,然后遵循https://facebook.github.io/react-native/docs/navigation的第一部分,直到您了解有关react-navigation-stack的部分。如果有更多我可以提供的信息,我会很乐意提供。

这是我的package.json文件:

{
  "name": "MyApp_ReactNative",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "16.8.6",
    "react-native": "^0.60.0",
    "react-native-gesture-handler": "^1.5.1",
    "react-native-reanimated": "^1.4.0",
    "react-native-screens": "1.0.0-alpha.23",
    "react-native-windows": "0.60.0-vnext.74",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^1.10.3",
    "rnpm-plugin-windows": "^0.3.8"
  },
  "devDependencies": {
    "@babel/core": "^7.7.2",
    "@babel/runtime": "^7.7.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.6.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.57.0",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
}

0 个答案:

没有答案