Skip to content

Commit

Permalink
fix(agenda): do not crash if scrolling to non-existing day
Browse files Browse the repository at this point in the history
  • Loading branch information
Tautvilas committed May 18, 2017
1 parent 121ec11 commit ba3b3ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion example/src/screens/agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default class AgendaScreen extends Component {
<Agenda
items={this.state.items}
loadItemsForMonth={this.loadItems.bind(this)}
firstDay={1}
selected={'2012-05-16'}
renderItem={this.renderItem.bind(this)}
renderEmptyDate={this.renderEmptyDate.bind(this)}
Expand Down
4 changes: 3 additions & 1 deletion src/agenda/reservation-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ class ReactComp extends Component {
}
topRowOffset += this.heights[topRow];
}
const day = this.state.reservations[topRow].day;
const row = this.state.reservations[topRow];
if (!row) return;
const day = row.day;
const sameDate = dateutils.sameDate(day, this.selectedDay);
if (!sameDate && this.scrollOver) {
this.selectedDay = day.clone();
Expand Down

0 comments on commit ba3b3ed

Please sign in to comment.