Skip to content

Commit 4569eb1

Browse files
author
Marco Cesarato
committed
fix: change checks for disabled and editable with null permitted
1 parent 161a772 commit 4569eb1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/InputSpinner.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,10 @@ class InputSpinner extends Component {
636636
* @returns {boolean|Boolean}
637637
*/
638638
isEditable() {
639-
return !this.props.disabled && this.props.editable;
639+
return (
640+
(this.props.disabled !== true || this.props.disabled != null) &&
641+
this.props.editable !== false
642+
);
640643
}
641644

642645
/**
@@ -652,15 +655,15 @@ class InputSpinner extends Component {
652655
* @returns {boolean|Boolean}
653656
*/
654657
isEmptied() {
655-
return this.props.emptied;
658+
return this.props.emptied !== false;
656659
}
657660

658661
/**
659662
* Is text input focused
660663
* @returns {boolean|Boolean}
661664
*/
662665
isFocused() {
663-
return this.state.focus;
666+
return this.state.focus !== false;
664667
}
665668

666669
/**
@@ -669,7 +672,9 @@ class InputSpinner extends Component {
669672
* @private
670673
*/
671674
_isDisabledButtonLeft() {
672-
return this.props.disabled || this.props.buttonLeftDisabled;
675+
return (
676+
this.props.disabled !== false || this.props.buttonLeftDisabled !== false
677+
);
673678
}
674679

675680
/**
@@ -678,7 +683,9 @@ class InputSpinner extends Component {
678683
* @private
679684
*/
680685
_isDisabledButtonRight() {
681-
return this.props.disabled || this.props.buttonRightDisabled;
686+
return (
687+
this.props.disabled !== false || this.props.buttonRightDisabled !== false
688+
);
682689
}
683690

684691
/**

0 commit comments

Comments
 (0)