2

我目前正在开发一个简单的“hello-world”类型项目,它在 Android 和 UWP 上都可以正常工作,直到我使用import { createStackNavigator } from 'react-navigation-stack';. App.js该应用程序仍然可以在 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"
  }
}
4

0 回答 0