This commit is contained in:
2025-11-12 16:03:57 +07:00
parent 87269a6615
commit 0ca7536b70
11 changed files with 1250 additions and 60 deletions

View File

@@ -1,31 +1,10 @@
import { Tabs } from "expo-router";
import { Ionicons } from "@expo/vector-icons";
import { Button, Alert } from "react-native";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { useRouter } from "expo-router";
export default function TabsLayout() {
const router = useRouter();
const handleLogout = async () => {
Alert.alert("Đăng xuất", "Bạn có chắc muốn đăng xuất?", [
{
text: "Hủy",
style: "cancel",
},
{
text: "Đăng xuất",
style: "destructive",
onPress: async () => {
await AsyncStorage.removeItem("authToken");
router.replace("/"); // quay về màn hình đăng nhập
},
},
]);
};
return (
<Tabs screenOptions={{ headerShown: true, tabBarActiveTintColor: "#007AFF" }}>
<Tabs screenOptions={{ headerShown: false, tabBarActiveTintColor: "#007AFF" }}>
<Tabs.Screen
name="home"
options={{
@@ -45,7 +24,6 @@ export default function TabsLayout() {
options={{
title: "Tài khoản",
tabBarIcon: ({ color, size }) => <Ionicons name="person" color={color} size={size} />,
headerRight: () => <Button title="Logout" onPress={handleLogout} color="#FF3B30" />,
}}
/>
</Tabs>