'Error while adding navigation in react native project

I have a login, register and a home screen in react native. While adding navigation part in app.js , i get this error below: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. app.js



Solution 1:[1]

You can use 'createNativeStackNavigator' instead of 'createStackNavigator'. To install it run:

npm install @react-navigation/native-stack

Inside App.js :

import { createNativeStackNavigator } from '@react-navigation/native-stack';

const Stack = createNativeStackNavigator();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 M Modi