import React, { useState } from "react"; import { View, Text, TouchableOpacity, ScrollView, Modal, Image, Animated, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { useNavigation } from "@react-navigation/native"; import { useAuth } from "../../hooks/useAuth"; // Side Menu Component function SideMenu({ visible, onClose }) { const navigation = useNavigation(); const slideAnim = React.useRef(new Animated.Value(visible ? 0 : -300)).current; const { user } = useAuth(); React.useEffect(() => { Animated.timing(slideAnim, { toValue: visible ? 0 : -300, duration: 300, useNativeDriver: true, }).start(); }, [visible, slideAnim]); const menuItems = [ { id: "home", label: "Homepage", icon: "home", screen: "home" }, { id: "discover", label: "Discover", icon: "search", screen: "discover" }, { id: "orders", label: "My Order", icon: "list", screen: "orders" }, { id: "profile", label: "My profile", icon: "person", screen: "account" }, ]; const otherItems = [ { id: "setting", label: "Setting", icon: "settings", screen: "setting" }, { id: "support", label: "Support", icon: "help-circle", screen: "support" }, { id: "about", label: "About us", icon: "information-circle", screen: "about" }, ]; const dropdownItems = [ { id: "cart", label: "Giỏ hàng", icon: "cart", screen: "cart" }, { id: "wishlist", label: "Yêu thích", icon: "heart", screen: "wishlist" }, { id: "checkout", label: "Thanh toán", icon: "checkmark-circle", screen: "checkout" }, ]; return ( {/* Overlay */} {/* Animated Menu */} {/* User Profile */} {user?.email?.split("@")[0] || "Guest"} {user?.email || "guest@example.com"} {/* Main Menu */} {menuItems.map((item) => ( { navigation.navigate(item.screen); onClose(); }} > {item.label} ))} {/* Other Section */} OTHER {otherItems.map((item) => ( { navigation.navigate(item.screen); onClose(); }} > {item.label} ))} {/* Dropdown Items Section */} QUICK ACCESS {dropdownItems.map((item) => ( { navigation.navigate(item.screen); onClose(); }} > {item.label} ))} {/* Theme Toggle */} Light Dark ); } // Product Card Component function ProductCard({ product }) { return ( {product.name} {product.price} đ ); } // Home Screen export default function HomeScreen() { const [sideMenuVisible, setSideMenuVisible] = useState(false); const featureProducts = [ { id: 1, name: "iphone 15 Pro Max 256GB", price: "29.990.000" }, { id: 2, name: "Samsung Galaxy S24 Ultra", price: "27.990.000" }, { id: 3, name: "Xiaomi 14 Ultra", price: "24.990.0000" }, ]; return ( setSideMenuVisible(true)}> Gemstore {/* Main Content */} {/* Banner */} Autumn Collection 2022 {/* Feature Products */} Feature Products Show all {featureProducts.map((product) => ( ))} {/* Side Menu */} setSideMenuVisible(false)} /> ); }