CalendarPicker
CalendarPicker copied to clipboard
How can the day stay highlighted when selected or called by the API?
It allows me to select and date and I am sucessfully catching and saving it to DB, as well as displaying in various places. But I dont have a prop in the component to also display it there. When I click on a day, it colors as instructed. Then I move away from the page and come back and although it successfully captured my date, it is unselected from the calendar's UI
<CalendarPicker
style={{backgroundColor: activeColors.primary}}
minDate={minDate}
width={width * .83}
todayBackgroundColor={activeColors.black}
todayTextStyle={{
color: activeColors.white,
}}
selectedDayColor={activeColors.primary}
selectedDayTextColor={activeColors.white}
textStyle={{
color: activeColors.textcolor,
}}
selectedDate={selectedDate || user.selectedDate} // Ideally, this would be great. But there is no such prop
onDateChange={setSelectedDate}
/>
Try selectedStartDate
. That's used for a single date, and if date range is enabled, in conjunction with selectedEndDate
selectedStartDate
That did it! The UX guy inside me tells me that there should be selectedDate for single day selections, since selectedStartDate implies a range and this wasn't the case. Or perhaps mentioned in the docs that this acts as a day selection for single days as well. But thank you!!