Hello i try to learn react-native and i try to do a button who redirect at "settings":
import Home from './components/Home'
import Settings from './components/Settings'
import * as React from 'react';
import { Text,Button,Navigation, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { useNavigation } from '@react-navigation/native';
const Tab = createBottomTabNavigator();
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name="Home" component={Home} />
</Tab.Navigator>
<Button
title="Press me"
color="#f194ff"
onPress={() => navigation.navigate("Settings")}
/>
</NavigationContainer>
);
}
With tab navigator, component settings function but when i try with button "ReferenceError: navigation is not defined"
I know that's a simple question but i have already this error (i tried to do "onPress={() => component={Home}} but that doesn't function too
Thanks!