import React, { useState, useEffect } from 'react'; import { Modal, Text, TouchableOpacity, View } from 'react-native'; import DateTimePicker, { DateType, useDefaultStyles } from 'react-native-ui-datepicker'; import { Check, X } from 'lucide-react-native'; export const RangePickerModal = ({ visible, onClose, currentRange, onApply }: any) => { // Stato locale temporaneo per la selezione nel modale const [localRange, setLocalRange] = useState(currentRange); // Sincronizza lo stato locale quando il modale si apre useEffect(() => { if (visible) setLocalRange(currentRange); }, [visible, currentRange]); return ( Seleziona Periodo setLocalRange(params)} // selectedItemColor="#099499" // headerTextStyle={{ color: '#1f2937', fontWeight: 'bold', fontSize: 18 }} // calendarTextStyle={{ color: '#374151' }} // weekDaysTextStyle={{ color: '#9ca3af', fontWeight: 'bold' }} /> { onApply(localRange); onClose(); }} className="mt-6 bg-[#099499] rounded-xl py-4 flex-row justify-center items-center active:bg-[#077d82]" > Applica Filtro ); };