import React from "react"; import { FlatList, ScrollView, StyleSheet, Text, View } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; export type Corrida = { id: string; data: string; empresa: string; km: number; custoPorKm: number; total: number; usuario: string; }; interface HistoricoProps { historico: Corrida[]; } const HistoricoItem = ({ item, index }: { item: Corrida; index: number }) => ( #{index + 1} {item.data} {item.empresa} Distância {item.km} km Valor/km R$ {item.custoPorKm.toFixed(2)} Total R$ {item.total.toFixed(2)} ); export default function Historico({ historico }: HistoricoProps) { return ( Histórico de Corridas {historico.length} corrida{historico.length !== 1 ? "s" : ""} {historico.length === 0 ? ( 🚗 Nenhuma corrida registrada Suas corridas aparecerão aqui ) : ( item.id} renderItem={({ item, index }) => ( )} contentContainerStyle={styles.listContent} showsVerticalScrollIndicator={false} /> )} ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#ffffff", }, header: { paddingHorizontal: 16, paddingTop: 16, paddingBottom: 24, backgroundColor: "#ffffff", borderBottomWidth: 2, borderBottomColor: "#000000", }, title: { fontSize: 28, fontWeight: "800", color: "#000000", marginBottom: 4, }, subtitle: { fontSize: 14, color: "#333333", }, listContent: { padding: 16, paddingBottom: 32, }, item: { backgroundColor: "#ffffff", borderRadius: 12, marginBottom: 12, overflow: "hidden", borderWidth: 1, borderColor: "#000000", }, itemHeader: { flexDirection: "row", paddingHorizontal: 16, paddingTop: 12, paddingBottom: 8, justifyContent: "space-between", alignItems: "center", borderBottomWidth: 1, borderBottomColor: "#e0e0e0", }, itemNumber: { fontSize: 12, fontWeight: "700", color: "#000000", }, itemDate: { fontSize: 12, color: "#666666", }, itemEmpresa: { paddingHorizontal: 16, paddingVertical: 10, backgroundColor: "#f5f5f5", }, empresaLabel: { fontSize: 14, fontWeight: "600", color: "#000000", }, itemDetails: { flexDirection: "row", paddingHorizontal: 16, paddingVertical: 12, gap: 8, }, detailBox: { flex: 1, paddingVertical: 8, }, detailLabel: { fontSize: 11, color: "#666666", fontWeight: "500", marginBottom: 2, }, detailValue: { fontSize: 14, fontWeight: "700", color: "#000000", }, emptyContainer: { flex: 1, justifyContent: "center", alignItems: "center", padding: 16, }, emptyBox: { alignItems: "center", }, emptyEmoji: { fontSize: 48, marginBottom: 16, }, emptyTitle: { fontSize: 18, fontWeight: "600", color: "#000000", marginBottom: 8, }, emptyText: { fontSize: 14, color: "#666666", textAlign: "center", }, });