Invariant Violation: requireNativeComponent: "RNCSafeAreaProvider" was not found in the UIManager

da coconut picture da coconut · May 23, 2020 · Viewed 16.7k times · Source

THIS IS MY ERROR

Can anyone help me with this issue?

Answer

Patricio Marrone picture Patricio Marrone · May 23, 2020

TL;DR

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

My case

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 ...]

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

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",

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.