Skip to content

Commit

Permalink
fix(datepicker): Firing the onBlur event passed as prop (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurdenner authored Oct 31, 2018
1 parent 1ac5a06 commit cb79621
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class SemanticDatepicker extends React.Component {
keepOpenOnClear: PropTypes.bool,
keepOpenOnSelect: PropTypes.bool,
locale: PropTypes.object,
onBlur: PropTypes.func,
onDateChange: PropTypes.func.isRequired,
placeholder: PropTypes.string,
selected: PropTypes.oneOfType([
Expand All @@ -78,6 +79,7 @@ class SemanticDatepicker extends React.Component {
keepOpenOnClear: false,
keepOpenOnSelect: false,
locale: localeEn,
onBlur: () => {},
placeholder: null,
pointing: 'left',
selected: null,
Expand Down Expand Up @@ -235,10 +237,12 @@ class SemanticDatepicker extends React.Component {
});
};

handleBlur = () => {
const { format } = this.props;
handleBlur = event => {
const { format, onBlur } = this.props;
const { typedValue } = this.state;

onBlur(event);

if (!typedValue) {
return;
}
Expand Down

1 comment on commit cb79621

@vercel
Copy link

@vercel vercel bot commented on cb79621 Oct 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.