Skip to content

Commit

Permalink
fix(NumberInput): add defaultValue typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod committed Nov 18, 2020
1 parent 085580b commit 7864090
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/react/src/components/NumberInput/NumberInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ class NumberInput extends Component {
this.state = {};
return;
}
let value = useControlledStateWithValue ? props.defaultValue : props.value;
let value =
useControlledStateWithValue || typeof props.defaultValue !== 'undefined'
? props.defaultValue
: props.value;
value = value === undefined ? 0 : value;
if (props.min || props.min === 0) {
value = Math.max(props.min, value);
Expand Down

0 comments on commit 7864090

Please sign in to comment.