在UIManager中找不到不变的违规:requireNativeComponent:“ RNCSafeAreaProvider”

时间:2020-05-23 03:20:29

标签: react-native expo

THIS IS MY ERROR

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

3 个答案:

答案 0 :(得分:34)

TL; DR

尝试使用npm install -g expo-cli升级expo CLI并运行expo update来修复依赖性。

我的案子

我今天在尝试设置React Navigation时在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兼容的东西似乎可以解决我的问题

npm install -g expo-cli
expo update

我注意到某些依赖关系已还原为现在似乎有效的旧版本。例如。 (在package.json中):

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

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

答案 1 :(得分:13)

停止运行您的应用。执行 npx pod-install ios 。然后重建您的应用程序。这对我有用。

答案 2 :(得分:0)

expo update对我不起作用:(

在控制台中运行yarn start时,我得到了:

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: ^3.0.2
 - @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 install <package>@<version>,它现在正在运行!