Skip to content

Commit 2cf6558

Browse files
committed
chore: change prop to typing time
1 parent a1d6275 commit 2cf6558

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

index.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {debounce, isNumeric, isEmpty} from "./utils";
1010
const defaultColor = "#3E525F";
1111
const defaultLongPressDelay = 750;
1212
const defaultLongPressSpeed = 7;
13-
const defaultDebounceTime = 500;
13+
const defaultTypingTime = 500;
1414

1515
/**
1616
* Input Spinner
@@ -44,8 +44,14 @@ class InputSpinner extends Component {
4444
initialValue = this.withinRange(initialValue, min, max);
4545

4646
// Set debounce
47-
this._debounceSetMax = debounce(this._setStateMax.bind(this), this.props.debounceTime);
48-
this._debounceSetMin = debounce(this._setStateMin.bind(this), this.props.debounceTime);
47+
this._debounceSetMax = debounce(
48+
this._setStateMax.bind(this),
49+
this.props.typingTime,
50+
);
51+
this._debounceSetMin = debounce(
52+
this._setStateMin.bind(this),
53+
this.props.typingTime,
54+
);
4955

5056
this.state = {
5157
min: min,
@@ -157,7 +163,7 @@ class InputSpinner extends Component {
157163
}
158164
}
159165
if (!isEmpty(value)) {
160-
if(parsedNum === num) {
166+
if (parsedNum === num) {
161167
clearTimeout(this.minTimer);
162168
clearTimeout(this.maxTimer);
163169
}
@@ -269,19 +275,19 @@ class InputSpinner extends Component {
269275
return hasPlaceholder
270276
? ""
271277
: value.replace(
272-
".",
273-
!isEmpty(this.props.decimalSeparator)
274-
? this.props.decimalSeparator
275-
: ".",
276-
);
278+
".",
279+
!isEmpty(this.props.decimalSeparator)
280+
? this.props.decimalSeparator
281+
: ".",
282+
);
277283
}
278284

279285
/**
280286
* Get Placeholder
281287
* @returns {*}
282288
*/
283289
getPlaceholder() {
284-
if(isEmpty(this.props.placeholder)) {
290+
if (isEmpty(this.props.placeholder)) {
285291
return this.state.min;
286292
} else {
287293
return this.state.placeholder;
@@ -565,8 +571,8 @@ class InputSpinner extends Component {
565571
return this.maxReached()
566572
? this._getColorMax()
567573
: this.minReached()
568-
? this._getColorMin()
569-
: this.props.color;
574+
? this._getColorMin()
575+
: this.props.color;
570576
}
571577

572578
/**
@@ -606,8 +612,8 @@ class InputSpinner extends Component {
606612
return this.maxReached()
607613
? this._getColorMax()
608614
: this.minReached()
609-
? this._getColorMin()
610-
: color;
615+
? this._getColorMin()
616+
: color;
611617
}
612618

613619
/**
@@ -960,7 +966,7 @@ InputSpinner.propTypes = {
960966
onSubmit: PropTypes.func,
961967
onLongPressDelay: PropTypes.number,
962968
onLongPressSpeed: PropTypes.number,
963-
debounceTime: PropTypes.number,
969+
typingTime: PropTypes.number,
964970
buttonLeftDisabled: PropTypes.bool,
965971
buttonRightDisabled: PropTypes.bool,
966972
buttonLeftText: PropTypes.string,
@@ -1018,7 +1024,7 @@ InputSpinner.defaultProps = {
10181024
height: 50,
10191025
onLongPressDelay: defaultLongPressDelay,
10201026
onLongPressSpeed: defaultLongPressSpeed,
1021-
debounceTime: defaultDebounceTime,
1027+
typingTime: defaultTypingTime,
10221028
buttonLeftDisabled: false,
10231029
buttonRightDisabled: false,
10241030
buttonLeftText: null,

0 commit comments

Comments
 (0)