不变违规:requireNativeComponent:"RNCSafeAreaProvider";在UIManager中找不到 [英] Invariant Violation: requireNativeComponent: "RNCSafeAreaProvider" was not found in the UIManager

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

问题描述

有人可以帮助我解决这个问题吗?

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.

我的案子

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

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

启动博览会时,我在控制台中注意到了此消息

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更新以将依赖项设置为与我的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中找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆