onDayPress not highlighting day. If I click on a day, the day is not highlighted
Selected day should be highlighted (blue background for example)
onDayPress is called but day is not highlighted
[email protected]
[email protected]
This is the code of the calendar:
<Calendar
current = {(this.state.booking_date) || this.state.min_date}
minDate={this.state.min_date}
maxDate={this.state.max_date}
onDayPress={(day) => this.onChangeDate(day)}
monthFormat={'MMMM yyyy'}
onMonthChange={(month) => {log('month changed', month)}}
hideExtraDays={true}
firstDay={1}
/>
I get the same behaviour even if I take off onDayPress function or If I copy example code.
Same for me...
Changing the relevant theme properties does not help neither.
same
can confirm this
Any updates on this topic? I am facing the same problem. Found out that removing markedDates somehow allows the selected day to be highlighted properly. Could not figure out what is the actual issue.
[UPDATE]
I fixed this issue by setting a "selected" rule for marked dates. What I needed was to keep all the dates disabled, except for my marked dates, which are defined on the server as an array of isoWeekdays.
Here is a snippet of how my marked dates object looks like:
markedDates[day.format('YYYY-MM-DD')] = { // day is a moment() object
disabled: false,
marked: true,
selected: this.state.selectedDay === day.format('YYYY-MM-DD'),
dotColor: 'green'
}
+1 , onDayPress not work backgroundColor selected
UPDATE
need add markedDates =>
markedDates={{[this.state.selected]: {selected: true, disableTouchEvent: true, selectedDotColor: 'orange'}}}
solved
@herarya thanks I don't why this is not on documentation.
Do you still have a problem?
Most helpful comment
+1 , onDayPress not work backgroundColor selected
UPDATE
need add markedDates =>
markedDates={{[this.state.selected]: {selected: true, disableTouchEvent: true, selectedDotColor: 'orange'}}}solved