我正在制作一个包含日历的日历,我想用数据库中的数据填充日历。数据库中的数据如下所示:
"meeting": [
{
"id": "",
"company_id": "",
"meeting_type_id": "",
"title": "zoom meeting",
"place": "zoom",
"description": "lorem ipsum",
"link": "zoom.com",
"date_time": "2021-06-20 08:03:00",
"status": 1,
"created_at": null,
"updated_at": null
}
]
我想要做的是将数据库中的标记日期添加到日历中。这是我到目前为止所做的,但没有出现标记的日期。
renderMeeting() {
let panels = [];
Object.keys(this.props.meeting).map((key, index) => {
panels.push(
<View key={index} style={styles.itemContainer}>
<TouchableOpacity>
<Text>{this.props.meeting.date_time}</Text>
<Text>{this.props.meeting.title}</Text>
</TouchableOpacity>
</View>,
);
});
}
renderItems() {
let items = [];
this.props.meeting.map((key, index) => {
items[this.props.meeting.date_time] = {
name: this.props.meeting.title,
};
});
}
render(){
let markedDay = {};
this.props.meeting.map(item => {
markedDay[item.date_time] = {
selected: true,
marked: true,
selectedColor: 'purple',
};
});
return(
<Agenda
items={this.renderItems()}
renderItem={this.renderMeeting()}
renderEmptyDate={() => <View />}
markedDates={this.props.meeting.date_time}
/>
)
}