Skip to content

Commit b0cdc2a

Browse files
committed
Add support for event props
1 parent e2c071c commit b0cdc2a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"dependencies": {
4545
"detect-element-overflow": "^1.1.1",
4646
"get-user-locale": "^1.1.1",
47+
"make-event-props": "^1.1.0",
4748
"merge-class-names": "^1.1.1",
4849
"prop-types": "^15.6.0",
4950
"react-calendar": "^2.17.4",

src/DateTimePicker.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { PureComponent } from 'react';
22
import PropTypes from 'prop-types';
33
import { polyfill } from 'react-lifecycles-compat';
4+
import makeEventProps from 'make-event-props';
45
import mergeClassNames from 'merge-class-names';
56
import detectElementOverflow from 'detect-element-overflow';
67

@@ -32,6 +33,10 @@ export default class DateTimePicker extends PureComponent {
3233

3334
state = {};
3435

36+
get eventProps() {
37+
return makeEventProps(this.props);
38+
}
39+
3540
componentDidMount() {
3641
document.addEventListener('mousedown', this.onClick);
3742
}
@@ -81,7 +86,11 @@ export default class DateTimePicker extends PureComponent {
8186
}
8287

8388
onFocus = (event) => {
84-
const { disabled } = this.props;
89+
const { disabled, onFocus } = this.props;
90+
91+
if (onFocus) {
92+
onFocus(event);
93+
}
8594

8695
// Internet Explorer still fires onFocus on disabled elements
8796
if (disabled) {
@@ -314,6 +323,7 @@ export default class DateTimePicker extends PureComponent {
314323
`${baseClassName}--${disabled ? 'disabled' : 'enabled'}`,
315324
className,
316325
)}
326+
{...this.eventProps}
317327
onFocus={this.onFocus}
318328
ref={(ref) => { this.wrapper = ref; }}
319329
>

0 commit comments

Comments
 (0)