Skip to content

Commit

Permalink
Merge pull request #3329 from newoga/#3305/date-picker
Browse files Browse the repository at this point in the history
[DatePicker] Remove window-listenable mixin
  • Loading branch information
oliviertassinari committed Feb 14, 2016
2 parents 7164a4f + 6be963d commit 3717d1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
14 changes: 5 additions & 9 deletions src/date-picker/calendar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import WindowListenable from '../mixins/window-listenable';
import EventListener from 'react-event-listener';
import DateTime from '../utils/date-time';
import KeyCode from '../utils/key-code';
import Transitions from '../styles/transitions';
Expand Down Expand Up @@ -37,10 +37,6 @@ const Calendar = React.createClass({
muiTheme: React.PropTypes.object,
},

mixins: [
WindowListenable,
],

getDefaultProps() {
return {
disableYearSelection: false,
Expand Down Expand Up @@ -81,10 +77,6 @@ const Calendar = React.createClass({
this.setState({muiTheme});
},

windowListeners: {
keydown: '_handleWindowKeyDown',
},

_yearSelector() {
if (this.props.disableYearSelection) return;

Expand Down Expand Up @@ -303,6 +295,10 @@ const Calendar = React.createClass({

return (
<ClearFix style={styles.root}>
<EventListener
elementName="window"
onKeyDown={this._handleWindowKeyDown}
/>
<DateDisplay
DateTimeFormat={DateTimeFormat}
locale={locale}
Expand Down
11 changes: 5 additions & 6 deletions src/date-picker/date-picker-dialog.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ContextPure from '../mixins/context-pure';
import WindowListenable from '../mixins/window-listenable';
import EventListener from 'react-event-listener';
import KeyCode from '../utils/key-code';
import Calendar from './calendar';
import Dialog from '../dialog';
Expand Down Expand Up @@ -43,7 +43,6 @@ const DatePickerDialog = React.createClass({
},

mixins: [
WindowListenable,
ContextPure,
],

Expand Down Expand Up @@ -92,10 +91,6 @@ const DatePickerDialog = React.createClass({
});
},

windowListeners: {
keyup: '_handleWindowKeyUp',
},

show() {
if (this.props.onShow && !this.state.open) this.props.onShow();
this.setState({
Expand Down Expand Up @@ -211,6 +206,10 @@ const DatePickerDialog = React.createClass({
open={this.state.open}
onRequestClose={this.dismiss}
>
<EventListener
elementName="window"
onKeyUp={this._handleWindowKeyUp}
/>
<Calendar
DateTimeFormat={DateTimeFormat}
firstDayOfWeek={firstDayOfWeek}
Expand Down
13 changes: 0 additions & 13 deletions src/date-picker/date-picker.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import WindowListenable from '../mixins/window-listenable';
import DateTime from '../utils/date-time';
import DatePickerDialog from './date-picker-dialog';
import TextField from '../text-field';
Expand Down Expand Up @@ -148,10 +147,6 @@ const DatePicker = React.createClass({
muiTheme: React.PropTypes.object,
},

mixins: [
WindowListenable,
],

getDefaultProps() {
return {
formatDate: DateTime.format,
Expand Down Expand Up @@ -192,10 +187,6 @@ const DatePicker = React.createClass({
}
},

windowListeners: {
keyup: '_handleWindowKeyUp',
},

getDate() {
return this.state.date;
},
Expand Down Expand Up @@ -240,10 +231,6 @@ const DatePicker = React.createClass({
}, 0);
},

_handleWindowKeyUp() {
//TO DO: open the dialog if input has focus
},

_isControlled() {
return this.props.hasOwnProperty('value') ||
this.props.hasOwnProperty('valueLink');
Expand Down

0 comments on commit 3717d1d

Please sign in to comment.