Skip to content

Commit b8af389

Browse files
committed
Fixes problems with input event overriding
1 parent 6596acb commit b8af389

6 files changed

+30
-23
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Changelog
22
=========
3+
## 2.16.1
4+
* Fixes input event overriding
5+
36
## 2.16.0
47
* The prop `disableOnClickOutside` has been renamed to `disableCloseOnClickOutside`
58
* The calendar doesn't get closed an open when clicking in the input anymore.

DateTime.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,15 +463,17 @@ var Datetime = createClass({
463463
children = [];
464464

465465
if ( this.props.input ) {
466-
var finalInputProps = assign({
467-
type: 'text',
468-
className: 'form-control',
469-
onClick: this.overrideEvent( 'onClick', this.openCalendar ),
470-
onFocus: this.overrideEvent( 'onFocus', this.openCalendar ),
471-
onChange: this.overrideEvent( 'onChange', this.onInputChange ),
472-
onKeyDown: this.overrideEvent( 'onKeyDown', this.onInputKey ),
473-
value: this.state.inputValue,
474-
}, this.props.inputProps);
466+
var finalInputProps = assign(
467+
{ type: 'text', className: 'form-control', value: this.state.inputValue },
468+
this.props.inputProps,
469+
{
470+
onClick: this.overrideEvent( 'onClick', this.openCalendar ),
471+
onFocus: this.overrideEvent( 'onFocus', this.openCalendar ),
472+
onChange: this.overrideEvent( 'onChange', this.onInputChange ),
473+
onKeyDown: this.overrideEvent( 'onKeyDown', this.onInputKey ),
474+
}
475+
);
476+
475477
if ( this.props.renderInput ) {
476478
children = [ React.createElement('div', { key: 'i' }, this.props.renderInput( finalInputProps, this.openCalendar, this.closeCalendar )) ];
477479
} else {

dist/react-datetime.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
react-datetime v2.16.0
2+
react-datetime v2.16.1
33
https://github.com/YouCanBookMe/react-datetime
44
MIT: https://github.com/YouCanBookMe/react-datetime/raw/master/LICENSE
55
*/
@@ -524,15 +524,17 @@ return /******/ (function(modules) { // webpackBootstrap
524524
children = [];
525525

526526
if ( this.props.input ) {
527-
var finalInputProps = assign({
528-
type: 'text',
529-
className: 'form-control',
530-
onClick: this.overrideEvent( 'onClick', this.openCalendar ),
531-
onFocus: this.overrideEvent( 'onFocus', this.openCalendar ),
532-
onChange: this.overrideEvent( 'onChange', this.onInputChange ),
533-
onKeyDown: this.overrideEvent( 'onKeyDown', this.onInputKey ),
534-
value: this.state.inputValue,
535-
}, this.props.inputProps);
527+
var finalInputProps = assign(
528+
{ type: 'text', className: 'form-control', value: this.state.inputValue },
529+
this.props.inputProps,
530+
{
531+
onClick: this.overrideEvent( 'onClick', this.openCalendar ),
532+
onFocus: this.overrideEvent( 'onFocus', this.openCalendar ),
533+
onChange: this.overrideEvent( 'onChange', this.onInputChange ),
534+
onKeyDown: this.overrideEvent( 'onKeyDown', this.onInputKey ),
535+
}
536+
);
537+
536538
if ( this.props.renderInput ) {
537539
children = [ React.createElement('div', { key: 'i' }, this.props.renderInput( finalInputProps, this.openCalendar, this.closeCalendar )) ];
538540
} else {

dist/react-datetime.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-datetime.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-datetime",
3-
"version": "2.16.0",
3+
"version": "2.16.1",
44
"description": "A lightweight but complete datetime picker React.js component",
55
"homepage": "https://github.com/YouCanBookMe/react-datetime",
66
"repository": {

0 commit comments

Comments
 (0)