Skip to content

Commit

Permalink
[DatePicker] Added disabled property and example
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejunges committed Jan 28, 2016
1 parent 6143384 commit 698186d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const DatePickerExampleSimple = () => (
<div>
<DatePicker hintText="Portrait Dialog" />
<DatePicker hintText="Landscape Dialog" mode="landscape" />
<DatePicker hintText="Portrait Dialog" disabled={true} />
</div>
);

Expand Down
13 changes: 10 additions & 3 deletions src/date-picker/date-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ const DatePicker = React.createClass({
*/
disableYearSelection: React.PropTypes.bool,

/**
* Disables the DatePicker.
*/
disabled: React.PropTypes.bool,

/**
* Used to change the first day of week. It drastically varies from
* Saturday to Monday (could even be Friday) between different locales.
Expand Down Expand Up @@ -163,6 +168,7 @@ const DatePicker = React.createClass({
formatDate: DateTime.format,
autoOk: false,
disableYearSelection: false,
disabled: false,
style: {},
firstDayOfWeek: 0,
};
Expand Down Expand Up @@ -248,9 +254,10 @@ const DatePicker = React.createClass({
_handleInputTouchTap: function _handleInputTouchTap(event) {
if (this.props.onTouchTap) this.props.onTouchTap(event);

setTimeout(() => {
this.openDialog();
}, 0);
if (!this.props.disabled)
setTimeout(() => {
this.openDialog();
}, 0);
},

_handleWindowKeyUp() {
Expand Down

0 comments on commit 698186d

Please sign in to comment.