react-native-calendars
react-native-calendars copied to clipboard
how to display multiple events per date
i m only able to display one item per date. so far i tried:
// Setting Booking Data to calender
setBookingDataCalender() {
let events = {};
console.log(this.props.getBookingData);
if (!this.props.getBookingData.loading) {
if (this.props.getBookingData.getAssetBokking.length > 0) {
this.props.getBookingData.getAssetBokking.map((item) => {
console.log(moment(item.start).format('YYYY-MM-DD'));
events[moment(item.start).format('YYYY-MM-DD')] = [];
events[moment(item.start).format('YYYY-MM-DD')].push({ start: moment(item.start),
end: moment(item.end),
title: item.asset.name,
status: item.status
});
}
)
}
} else {
console.log('no loading');
}
this.setState({ events });
}
loadItems(day) {
setTimeout(() => {
const newItems = {};
Object.keys(this.state.events).forEach(key => { newItems[key] = this.state.events[key]; });
this.setState({
events: newItems
});
}, 1000);
}
renderAgenda() {
return (
<Agenda
items={this.state.events}
loadItemsForMonth={this.loadItems.bind(this)}
renderItem={this.renderItem.bind(this)}
renderEmptyDate={this.renderEmptyDate.bind(this)}
rowHasChanged={this.rowHasChanged.bind(this)}
/>
);
}

Same