Skip to content

Commit

Permalink
Fix negative timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
nkbt committed Oct 17, 2019
1 parent 7609c9f commit bd39f97
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,24 @@ export class DebounceInput extends React.PureComponent {


onKeyDown = event => {
const {onKeyDown} = this.props;

if (event.key === 'Enter') {
this.forceNotify(event);
}
// Invoke original onKeyDown if present
const {onKeyDown} = this.props;
if (onKeyDown) {
event.persist();
onKeyDown(event);
}
};


onBlur = event => {
const {onBlur} = this.props;

this.forceNotify(event);
// Invoke original onBlur if present
const {onBlur} = this.props;
if (onBlur) {
event.persist();
onBlur(event);
}
};
Expand Down Expand Up @@ -154,7 +154,8 @@ export class DebounceInput extends React.PureComponent {


forceNotify = event => {
if (!this.isDebouncing) {
const {debounceTimeout} = this.props;
if (!this.isDebouncing && debounceTimeout > 0) {
return;
}

Expand Down

0 comments on commit bd39f97

Please sign in to comment.