import React from 'react';
import { View, Text, FlatList, StyleSheet } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { COLORS } from '../constants/colors';
const TransactionList = ({ transactions }) => {
if (!transactions || transactions.length === 0) {
return (
Soňky 10 günde kart hereketleri ýok...
);
}
const groupedTransactions = transactions.reduce((acc, transaction) => {
const date = new Date(transaction.date).toLocaleDateString('tk', {
year: 'numeric',
month: 'long',
day: 'numeric',
});
if (!acc[date]) {
acc[date] = [];
}
acc[date].push(transaction);
return acc;
}, {});
const renderTransactionItem = ({ item }) => (
{item.description}
{item.time ?? '-'}
{item.type === 'credit' ? '+' : '-'}
{item.amount} {item.currency}
);
const renderTransactionSection = ({ item: date }) => (
{date}
item.id?.toString()}
scrollEnabled={false}
ItemSeparatorComponent={() => }
/>
);
return (
date}
scrollEnabled={false}
ItemSeparatorComponent={() => }
/>
);
};
const styles = StyleSheet.create({
container: {
padding: 16,
},
emptyText: {
textAlign: 'center',
color: COLORS.textSecondary,
},
transactionItem: {
flexDirection: 'row',
alignItems: 'center',
paddingVertical: 12,
},
transactionIcon: {
width: 44,
height: 44,
borderRadius: 22,
backgroundColor: COLORS.background,
alignItems: 'center',
justifyContent: 'center',
marginRight: 16,
},
transactionDetails: {
flex: 1,
},
transactionTitle: {
fontSize: 16,
fontWeight: '600',
color: COLORS.textPrimary,
marginBottom: 2,
},
transactionDate: {
fontSize: 13,
color: COLORS.textSecondary,
},
transactionAmount: {
fontSize: 16,
fontWeight: '700',
},
transactionDateHeader: {
fontSize: 14,
fontWeight: '600',
color: COLORS.textSecondary,
backgroundColor: COLORS.white,
paddingTop: 16,
paddingBottom: 8,
paddingHorizontal: 4,
},
separator: {
height: 1,
backgroundColor: COLORS.gray[200],
marginLeft: 60,
},
});
export default TransactionList;