In react native calendar there are markedDates which are providing the planned events. The code for a manual entry is following:
markedDates={{
'2012-05-16': {selected: true, marked: true, selectedColor: 'blue'},
'2012-05-17': {marked: true},
'2012-05-18': {marked: true, dotColor: 'red', activeOpacity: 0},
'2012-05-19': {disabled: true, disableTouchEvent: true}
}}
What do I have to do to set the markedDates dynamically out of an array?
That is the line from the render():
markedDates={this.state.selectedDate, this.state.markedDates}
This is executed in componentDidMount:
var selectedDate = {}
selectedDate[dateString] = { selected: true, selectedColor: '#c4c4c4', text: { color: 'black' } }
this.setState({
selectedDate: selectedDate
})
Dynamically mark dates in react-native-calendars This is a link to a similar question but it doesn't really answer it or I don't understand the answer. Both is possible