I have stack navigation, and I would like to access the ‘NewPost’ component, but it shows the error above
import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createStackNavigator } from '@react-navigation/stack';
import Feather from 'react-native-vector-icons/Feather';
import Home from '../pages/Home';
import Profile from '../pages/Profile';
import Search from '../pages/Search';
import NewPost from '../pages/NewPost';
import PostUser from '../pages/PostUser';
// import { Keyboard } from 'react-native';
const Tab = createBottomTabNavigator();
const Stack = createStackNavigator();
//NAVEGAÇÃO EM PILHA
function StackScreen(){
return(
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} options={{ headerShown: false }} />
<Stack.Screen name="NewPost" component={NewPost} />
<Stack.Screen name="PostUser" component={PostUser}/>
</Stack.Navigator>
);
}
import React from 'react';
import { View, Text } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import Feather from 'react-native-vector-icons/Feather';
import { Container, ButtonPost } from './styles';
export default function Home() {
const navigation = useNavigation();
return (
<Container>
<ButtonPost onPress={() => navigation.navigate('NewPost') }>
<Feather
name="edit-2"
color="#FFF"
size={25}
/>
</ButtonPost>
</Container>
);
}
“dependencies”: {
“@react-native-async-storage/async-storage”: “^1.23.1”,
“@react-native-community/masked-view”: “^0.1.11”,
“@react-native-firebase/app”: “^19.2.2”,
“@react-native-firebase/auth”: “^19.2.2”,
“@react-native-firebase/firestore”: “^19.2.2”,
“@react-native-firebase/storage”: “^19.2.2”,
“@react-navigation/bottom-tabs”: “^6.5.20”,
“@react-navigation/native”: “^6.1.17”,
“@react-navigation/stack”: “^6.3.29”,
“react”: “18.2.0”,
“react-native”: “0.74.0”,
“react-native-gesture-handler”: “^2.16.1”,
“react-native-reanimated”: “^3.9.0”,
“react-native-safe-area-context”: “^4.10.1”,
“react-native-screens”: “^3.31.1”,
“react-native-vector-icons”: “^10.1.0”,
“styled-components”: “^6.1.8”
},
I’m new to programming and I really don’t know where I’m going wrong, thanks in advance for any help
user24653085 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.