Skip to content

Commit cb79621

Browse files
authored
fix(datepicker): Firing the onBlur event passed as prop (#15)
1 parent 1ac5a06 commit cb79621

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/components/datepicker.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class SemanticDatepicker extends React.Component {
5858
keepOpenOnClear: PropTypes.bool,
5959
keepOpenOnSelect: PropTypes.bool,
6060
locale: PropTypes.object,
61+
onBlur: PropTypes.func,
6162
onDateChange: PropTypes.func.isRequired,
6263
placeholder: PropTypes.string,
6364
selected: PropTypes.oneOfType([
@@ -78,6 +79,7 @@ class SemanticDatepicker extends React.Component {
7879
keepOpenOnClear: false,
7980
keepOpenOnSelect: false,
8081
locale: localeEn,
82+
onBlur: () => {},
8183
placeholder: null,
8284
pointing: 'left',
8385
selected: null,
@@ -235,10 +237,12 @@ class SemanticDatepicker extends React.Component {
235237
});
236238
};
237239

238-
handleBlur = () => {
239-
const { format } = this.props;
240+
handleBlur = event => {
241+
const { format, onBlur } = this.props;
240242
const { typedValue } = this.state;
241243

244+
onBlur(event);
245+
242246
if (!typedValue) {
243247
return;
244248
}

0 commit comments

Comments
 (0)