Skip to content

Commit

Permalink
added touch support.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidworkman9 authored and simeg committed Feb 7, 2018
1 parent 4eb1d6d commit de20528
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/TimeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ var DateTimePickerTime = onClickOutside( createClass({
}
}
return React.createElement('div', { key: type, className: 'rdtCounter' }, [
React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'increase', type ), onContextMenu: this.disableContextMenu }, '▲' ),
React.createElement('span', { key: 'up', className: 'rdtBtn', onTouchStart: this.onStartClicking('increase', type), onMouseDown: this.onStartClicking( 'increase', type ), onContextMenu: this.disableContextMenu }, '▲' ),
React.createElement('div', { key: 'c', className: 'rdtCount' }, value ),
React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'decrease', type ), onContextMenu: this.disableContextMenu }, '▼' )
React.createElement('span', { key: 'do', className: 'rdtBtn', onTouchStart: this.onStartClicking('decrease', type), onMouseDown: this.onStartClicking( 'decrease', type ), onContextMenu: this.disableContextMenu }, '▼' )
]);
}
return '';
},

renderDayPart: function() {
return React.createElement('div', { key: 'dayPart', className: 'rdtCounter' }, [
React.createElement('span', { key: 'up', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▲' ),
React.createElement('span', { key: 'up', className: 'rdtBtn', onTouchStart: this.onStartClicking('toggleDayPart', 'hours'), onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▲' ),
React.createElement('div', { key: this.state.daypart, className: 'rdtCount' }, this.state.daypart ),
React.createElement('span', { key: 'do', className: 'rdtBtn', onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▼' )
React.createElement('span', { key: 'do', className: 'rdtBtn', onTouchStart: this.onStartClicking('toggleDayPart', 'hours'), onMouseDown: this.onStartClicking( 'toggleDayPart', 'hours'), onContextMenu: this.disableContextMenu }, '▼' )
]);
},

Expand Down Expand Up @@ -181,9 +181,11 @@ var DateTimePickerTime = onClickOutside( createClass({
clearInterval( me.increaseTimer );
me.props.setTime( type, me.state[ type ] );
document.body.removeEventListener( 'mouseup', me.mouseUpListener );
document.body.removeEventListener( 'touchend', me.mouseUpListener );
};

document.body.addEventListener( 'mouseup', me.mouseUpListener );
document.body.addEventListener( 'touchend', me.mouseUpListener );
};
},

Expand Down

0 comments on commit de20528

Please sign in to comment.