I have a problem developing a calendar where it marks events on the appropriate dates, I receive the dates in the following way in PHP
[
{
"status": "OK",
"statusCode": 200,
"statusMensagem": "Listado com sucesso!",
"arrayDados": [
{
"data": "2024-01-17",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-17",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-17",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-24",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-19",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-18",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-19",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-19",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-23",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-24",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-24",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-26",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
},
{
"data": "2024-01-27",
"dadosDoDia": {
"selected": true,
"marked": true,
"selectedColor": "blue"
}
}
],
"ondeEstou": [],
"proximos": []
}
]
the code in the calendar is as follows:
<Calendar
style={[Styles.w95,{
borderTopLeftRadius:0,borderTopRightRadius:0,
borderBottomLeftRadius:20,borderBottomRightRadius:20,
marginTop:'2%',
borderWidth: 0,
borderColor: 'gray',
height: 350,
borderRadius:4,
}]}
current={new Date().toDateString()}
onDayPress={day => {
}}
markedDates={agenda}
/>
when I put markedDates like this:
markedDates={{
'2012-03-01': {selected: true, marked: true, selectedColor: 'blue'},
'2012-03-02': {marked: true},
'2012-03-03': {selected: true, marked: true, selectedColor: 'blue'}
}}
so it marks the dates correctly, but when it returns from the database it does not mark it and the following message appears.
Warning: Failed prop type: Invalid prop markedDates of type array supplied to Calendar, expected object.
at Calendar (http://192.168.1.7:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:223709:28)
could someone help me please
I can’t solve it, I need him to mark the dates like this