Sean  Lee
Sean Lee

Reputation: 37

How to solve "Unable to resolve "@react-navigation/stack" from "App.js" in React Native?

I did "npm install react-navigation" and imported "import { createStackNavigator } from '@react-navigation/stack';" but it still says "Unable to resolve "@react-navigation/stack" from "App.js"

How can I fix it and make it work?

Thank you

Upvotes: 0

Views: 329

Answers (1)

Milind Agrawal
Milind Agrawal

Reputation: 2934

Does @react-navigation/stack gets install when you install react-navigation? because I don't see anything in package.json

https://github.com/react-navigation/react-navigation/blob/master/package.json

I think you will have to install @react-navigation/stack manually using below

npm install @react-navigation/stack react-native-safe-area-context

FYI, Previously they had 3 things required for installation https://www.npmjs.com/package/react-navigation-stack, which is not mentioned in the new version.

If you still face issue of some unknown package being not available then try to check the old docs.

Upvotes: 1

Related Questions