本文介绍了不变违规:requireNativeComponent:“RNCSafeAreaProvider";在 UIManager 中找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装包npm install @react-navigation/native @react-navigation/stack的项目中实现React Navigate会出现如下错误.

Implementing React Navigate in the project installing the package npm install @react-navigation/native @react-navigation/stack shows the following error.

谁能帮我解决这个问题?

Can anyone help me with this issue?

推荐答案

TL;DR

尝试使用 npm install -g expo-cli 升级您的 expo CLI 并运行 expo update 以修复依赖关系.

Try upgrading your expo CLI with npm install -g expo-cli and running expo update to fix the dependencies.

我的情况

我今天在一个 expo 应用程序中尝试设置 React Navigation 时遇到了这个问题.

I experienced this issue today in an expo app while trying to setup React Navigation.

我在启动 expo 时在控制台中注意到此消息

I noticed this message in the console when launching expo

Some of your project's dependencies are not compatible with currently installed expo package version:
 - react-native-reanimated - expected version range: ~1.7.0 - actual version installed: ^1.9.0
 - react-native-screens - expected version range: ~2.2.0 - actual version installed: ^2.8.0
 - react-native-safe-area-context - expected version range: 0.7.3 - actual version installed: ^2.0.0
 - @react-native-community/masked-view - expected version range: 0.1.6 - actual version installed: ^0.1.10
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]

更新 expo 并运行 expo update 以将依赖项设置为与我的 SDK 兼容的东西似乎解决了我的问题

Updating expo and running expo update to set the dependencies to something compatible with my SDK seemed to solve the issue for me

npm install -g expo-cli
expo update

我注意到一些依赖项已恢复到现在似乎可以工作的旧版本.例如.(在 package.json 中):

I noticed that some dependencies were reverted to older versions that now seem to work. E.g. (in package.json):

-"react-native-safe-area-context": "^2.0.0",
+"react-native-safe-area-context": "0.7.3",

即使警告消息明确指示我为每个有问题的依赖项运行 expo install,这样做也会导致引发错误的版本相同.

Even when the warning message explicitly instructed me to run the expo install for each problematic dependency, doing so would lead to the same version that was throwing the error.

这篇关于不变违规:requireNativeComponent:“RNCSafeAreaProvider";在 UIManager 中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 11:09