import { View, Text, SafeAreaView, ScrollView, Image, TouchableOpacity } from "react-native"; import React, { useEffect, useState } from "react"; import { useLocalSearchParams, router } from "expo-router"; import icons from "@/constants/icons"; import { getCar } from "@/lib/database"; const CarDetails = () => { const { id } = useLocalSearchParams(); const [carData, setCarData] = useState(null); useEffect(() => { const fetchCar = async () => { try { const car = await getCar(id as string); setCarData(car); } catch (error) { console.error('Error fetching car:', error); } }; fetchCar(); }, [id]); if (!carData) return null; return ( {/* Header */} {/* Back Button */} router.back()} className="absolute top-5 left-5 bg-white/90 p-2 rounded-full" > {/* Favorite Button */} {/* Content */} {/* Title and Rating */} {carData.title} {carData.rating} {/* Location */} {carData.location} {/* Price */} €{carData.price} {/* Details */} Car Details {carData.year} {carData.fuelType} {carData.transmission} {carData.mileage} km {/* Description */} Description {carData.description} {/* Bottom Actions */} Message Call ); }; export default CarDetails;