Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module '@react-navigation/native' or its corresponding type declarations

Im having trouble im my react-native app using expo and typescript. I have installed the libraries using npm and they are available in the node_modules folder see the picture. enter image description here

The same problem is happening for '@react-navigation/stack' and when I run the program I get this error:

 Error: Looks like you have nested a 'NavigationContainer' inside another. Normally you need only one container at the root of the app, so this was probably an error. If this was intentional, pass 'independent={true}' explicitely. Note that this will make the child navigators disconnected from the parent and you won't be able to navigate between them.

however my program have only one NavigationContainer. What seems to be the problem here ? P.S: I tried reinstalling the packages but still no progress.

like image 814
warCommander Avatar asked Nov 08 '25 11:11

warCommander


1 Answers

To solve these errors: Cannot find module X or its corresponding type declarations run:

yarn add @types/X -D

in your case: yarn add @types/@react-navigation/native @types/react-query -D

This will install type definitions for these libraries, if available.

like image 200
Marek Lisik Avatar answered Nov 10 '25 00:11

Marek Lisik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!