react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

how to display multiple events per date

Open ZeroCool00 opened this issue 8 years ago • 1 comments

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)}
			/>
		);
	}

screen

ZeroCool00 avatar Jul 08 '18 08:07 ZeroCool00

Same

PauZoffoli avatar Apr 05 '19 16:04 PauZoffoli