import React from "react";
import { View, Text, Button } from "react-native";
function HomeScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Home Screen</Text>
<Button
title="Kullanıcılar"
onPress={() => navigation.navigate("Users")}
/>
{/* <Button title="Users" onPress={() => navigation.push("Users")} /> */}
</View>
);
}
export default HomeScreen;
import { View, Text, Button } from "react-native";
import React from "react";
const UsersScreen = ({ navigation }) => {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>UsersScreen</Text>
<Button title="Anasayfa" onPress={() => navigation.navigate("Home")} />
<Button title="Geri" onPress={() => navigation.goBack()} />
{/* <Button title="Home" onPress={() => navigation.push("Home")} /> */}
</View>
);
};
export default UsersScreen;
//App.js
import * as React from "react";
import { View, Text } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import HomeScreen from "./src/screens/Home";
import UsersScreen from "./src/screens/Users";
// screens
const Stack = createNativeStackNavigator();
function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen
name="Home"
component={HomeScreen}
options={{
title: "Anasayfa",
}}
/>
<Stack.Screen
name="Users"
component={UsersScreen}
options={{ title: "Kullanıcılar" }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;