Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError : Object (...) is not a function react native stack navigation

I make an app with react native. I install all packages required to use stack navigation. But when I opened my project with the expo on the web. I got this error you see this in the image.

// In App.js in a new project
import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

function HomeScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
    </View>
  );
}

const Stack = createNativeStackNavigator();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

export default App;

Please Help I trying to solve this for two days please help me I got this error every time. Error Screenshot1

like image 882
Tech Sagan Avatar asked Sep 19 '26 08:09

Tech Sagan


1 Answers

Use this, it worked for me:

import { createStackNavigator } from "react-navigation-stack"
like image 83
DimasGs Avatar answered Sep 21 '26 21:09

DimasGs