Skip to content

Commit eeb225b

Browse files
committed
fix incrementing numeric; warnings
1 parent 591dc85 commit eeb225b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/widgets/EditableText.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ EditableText.propTypes = {
104104
text: PropTypes.any,
105105

106106
// Input properties
107-
placeholder: PropTypes.string,
107+
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
108108
className: PropTypes.string,
109109
disable: PropTypes.bool,
110110
autoFocus: PropTypes.bool,

src/components/widgets/NumericInput.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ export default class NumericInput extends Component {
8686
let valueUpdate;
8787
if (isNumeric(value)) {
8888
if (direction === 'increase') {
89-
valueUpdate = value + step;
89+
valueUpdate = parseFloat(value) + step;
9090
} else {
91-
valueUpdate = value - step;
91+
valueUpdate = parseFloat(value) - step;
9292
}
9393
} else {
9494
// if we are multi-valued and the user is incrementing or decrementing
@@ -138,7 +138,7 @@ export default class NumericInput extends Component {
138138
min={this.props.min}
139139
max={this.props.max}
140140
step={this.props.step}
141-
value={this.state.value}
141+
value={parseFloat(this.state.value)}
142142
onChange={this.updateValue}
143143
tooltip={false}
144144
/>
@@ -172,7 +172,7 @@ NumericInput.propTypes = {
172172
max: PropTypes.number,
173173
min: PropTypes.number,
174174
onUpdate: PropTypes.func.isRequired,
175-
placeholder: PropTypes.string,
175+
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
176176
showArrows: PropTypes.bool,
177177
showSlider: PropTypes.bool,
178178
step: PropTypes.number,

0 commit comments

Comments
 (0)