CalendarPicker icon indicating copy to clipboard operation
CalendarPicker copied to clipboard

How can the day stay highlighted when selected or called by the API?

Open lotusms opened this issue 1 year ago • 2 comments

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}
/>

2024-04-10_21-38-48

lotusms avatar Apr 11 '24 01:04 lotusms

Try selectedStartDate. That's used for a single date, and if date range is enabled, in conjunction with selectedEndDate

peacechen avatar Apr 11 '24 02:04 peacechen

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!!

lotusms avatar Apr 11 '24 11:04 lotusms