Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

THIS IS MY ERROR

Can anyone help me with this issue?

like image 637
da coconut Avatar asked May 23 '20 03:05

da coconut


People also ask

How install stack Navigator react native?

Installation​ To use this navigator, ensure that you have @react-navigation/native and its dependencies (follow this guide), then install @react-navigation/stack : npm. Yarn.

What is react native safe area context?

Fortunately, there is a cross-platform solution to handle safe areas on notch devices called react-native-safe-area-context. It provides a flexible API to handle safe area insets in JS and works on iOS, Android, and Web.


1 Answers

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.

like image 56
Patricio Marrone Avatar answered Sep 30 '22 13:09

Patricio Marrone