From 2ccd1d227eee94255fdec5e4e6f89be6b4273d83 Mon Sep 17 00:00:00 2001 From: orangemug Date: Sun, 19 Jan 2020 11:06:24 +0000 Subject: [PATCH] rangeValue -> dirtyValue --- src/components/inputs/NumberInput.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/inputs/NumberInput.jsx b/src/components/inputs/NumberInput.jsx index cd497caa..5d468fed 100644 --- a/src/components/inputs/NumberInput.jsx +++ b/src/components/inputs/NumberInput.jsx @@ -139,8 +139,8 @@ class NumberInput extends React.Component { this.props.min !== undefined && this.props.max !== undefined && this.props.allowRange ) { - const value = this.state.value === undefined ? this.props.default : this.state.value; - const rangeValue = Number.isNaN(parseFloat(value, 10)) ? this.props.default : value; + const dirtyValue = this.state.dirtyValue === undefined ? this.props.default : this.state.dirtyValue + const value = this.state.value === undefined ? "" : this.state.value; return
{ @@ -167,7 +167,7 @@ class NumberInput extends React.Component { spellCheck="false" className="maputnik-number" placeholder={this.props.default} - value={this.state.value === undefined ? "" : this.state.value} + value={value} onChange={e => { if (!this.state.editing) { this.changeValue(e.target.value); @@ -178,11 +178,13 @@ class NumberInput extends React.Component {
} else { + const value = this.state.value === undefined ? "" : this.state.value; + return this.changeValue(e.target.value)} onBlur={this.resetValue} required={this.props.required}