0

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

2
  • You need to install is seperately: npm install @react-navigation/stack Commented May 5, 2020 at 12:08
  • It still says "Unable to resolve "react-native-safe-area-context" Commented May 5, 2020 at 12:13

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

It still says "Unable to resolve "react-native-safe-area-context"
Seems like there are few peer dependencies as well. Edited my code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.