无法解析模块“反应本机屏幕”

时间:2019-12-24 22:03:24

标签: react-native navigation screen

我已经在互联网上搜索了至少1个小时,但没有任何反应。

我从Atome的Ract native中收到此错误:无法解析模块“ react-native-screen”

我该怎么办:

1- npm install-保存反应导航

I got :

2- npm安装

I got

当我运行我的应用程序后,出现错误:

谢谢!

8 个答案:

答案 0 :(得分:7)

使用以下步骤,将可以100%工作。

  1. 安装React导航

_

  1. 安装依赖项

npm install react-navigation

  1. 安装React导航堆栈

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

  1. 启动应用程序并使用npm start -c清除缓存

更新导入

npm install react-navigation-stack @react-native-community/masked-view

错误? 如果仍然看到有关程序包的错误和投诉,请执行以下操作:

  1. imports will look like this: import { createAppContainer } from 'react-navigation'; import { createStackNavigator } from 'react-navigation-stack';

  2. rm -r node_modules

  3. rm package-lock.json

  4. expo upgrade

答案 1 :(得分:1)

我使用了以下步骤:

npm install-保存反应导航

expo安装react-native-gesture-handler react-native-anianidated react-navigation-stack react-native-screens

expo install react-native-safe-area-view

博览会安装@ react-native-community / masked-view

答案 2 :(得分:1)

如果您将expo用于本机项目,那么要进行本机导航,则需要先在依赖项下面安装。

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

然后,在安装上述依赖项之后,您可以为各种类型的导航安装依赖项,例如-

  1. 底部标签导航npm install @react-navigation/bottom-tabs
  2. 抽屉导航npm install @react-navigation/drawer

答案 3 :(得分:0)

您需要再安装3个库react-native-gesture-handlerreact-native-reanimatedreact-native-screens

npm install --save react-native-gesture-handler react-native-reanimated react-native-screens

参考:https://reactnavigation.org/docs/en/getting-started.html#installing-dependencies-into-a-bare-react-native-project

答案 4 :(得分:0)

如果您下载了反应导航,那么没有react-native-gesture-handler ,react-native-reanimated, react-native-screens支持的库,它将无法工作

您可以通过yarn或npm下载它。

npm install  react-native-gesture-handler react-native-reanimated react-native-screens

yarn add react-native-gesture-handler react-native-reanimated react-native-screens

希望有帮助。毫无疑问

答案 5 :(得分:0)

好的,现在我已经完成了2项操作:

1-npm install-保存react-native-gesture-handler react-native-reanimated react-native-screens

AND

2-npm安装react-native-gesture-handler react-native-animated的react-native-screens

当我运行我的应用程序后,我又遇到了另一个错误和警告:

我应该做什么?

谢谢!

答案 6 :(得分:0)

在您的 .eslintrc.js 中添加以下行:

HttpServletRequest

在您的 .flowconfig 中添加以下内容:

InputStream

答案 7 :(得分:0)

如果要升级到SDK 39。

运行此命令:

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

谢谢。