Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DatePicker] Made sure we don't close the date picker when switching months with the autoOk prop set to true #830

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/date-picker/calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ var Calendar = React.createClass({
},

_addSelectedMonths: function(months) {
this._setSelectedDate(DateTime.addMonths(this.state.selectedDate, months));
var isNavigation = true;
this._setSelectedDate(DateTime.addMonths(this.state.selectedDate, months), null, isNavigation);
},

_addSelectedYears: function(years) {
Expand All @@ -232,7 +233,7 @@ var Calendar = React.createClass({
}
},

_setSelectedDate: function(date, e) {
_setSelectedDate: function(date, e, isNavigation) {
var adjustedDate = date;
if (DateTime.isBeforeDate(date, this.props.minDate)) {
adjustedDate = this.props.minDate;
Expand All @@ -249,7 +250,7 @@ var Calendar = React.createClass({
selectedDate: adjustedDate
});
}
if(this.props.onSelectedDate) this.props.onSelectedDate(e, date);
if(this.props.onSelectedDate) this.props.onSelectedDate(e, date, isNavigation);
},

_handleDayTouchTap: function(e, date) {
Expand Down
4 changes: 2 additions & 2 deletions src/date-picker/date-picker-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ var DatePickerDialog = React.createClass({
this.refs.dialogWindow.dismiss();
},

_onSelectedDate: function(e) {
if(this.props.autoOk) {
_onSelectedDate: function(e, date, isNavigation) {
if(this.props.autoOk && !isNavigation) {
setTimeout(this._handleOKTouchTap, 300);
}
},
Expand Down