import React from 'react'; import { Text, View, Pressable, StyleSheet } from 'react-native'; import { useCalendarContext } from '../CalendarContext'; import { getParsedDate, getMonths } from '../utils'; const MonthSelector = () => { const { currentDate, onSelectMonth, theme } = useCalendarContext(); const { month } = getParsedDate(currentDate); return ( {getMonths()?.map((item, index) => { const activeItemStyle = index === month ? { borderColor: theme?.selectedItemColor || '#0047FF', backgroundColor: theme?.selectedItemColor || '#0047FF', } : null; const textStyle = index === month ? { color: '#fff', ...theme?.selectedTextStyle } : theme?.calendarTextStyle; return ( onSelectMonth(index)} accessibilityRole="button" accessibilityLabel={item} > {item} ); })} ); }; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, monthsContainer: { flexDirection: 'row', flexWrap: 'wrap', }, monthCell: { width: '33.3%', }, month: { paddingVertical: 15, margin: 2, alignItems: 'center', borderWidth: 1, borderRadius: 8, borderColor: '#E5E5E5', backgroundColor: '#FFFFFF', }, }); export default MonthSelector;