mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix send screen value input
This commit is contained in:
parent
644adeccf6
commit
baebf64afd
@ -50,10 +50,18 @@ function sanitizeValue (value) {
|
|||||||
|
|
||||||
CurrencyInput.prototype.handleChange = function (newValue) {
|
CurrencyInput.prototype.handleChange = function (newValue) {
|
||||||
const { onInputChange } = this.props
|
const { onInputChange } = this.props
|
||||||
|
const { value } = this.state
|
||||||
|
|
||||||
this.setState({ value: sanitizeValue(newValue) })
|
let parsedValue = newValue
|
||||||
|
const newValueLastIndex = newValue.length - 1
|
||||||
|
|
||||||
onInputChange(sanitizeValue(newValue))
|
if (value === '0' && newValue[newValueLastIndex] === '0') {
|
||||||
|
parsedValue = parsedValue.slice(0, newValueLastIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
const sanitizedValue = sanitizeValue(parsedValue)
|
||||||
|
this.setState({ value: sanitizedValue })
|
||||||
|
onInputChange(sanitizedValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// If state.value === props.value plus a decimal point, or at least one
|
// If state.value === props.value plus a decimal point, or at least one
|
||||||
@ -90,6 +98,6 @@ CurrencyInput.prototype.render = function () {
|
|||||||
size: valueToRender.length * inputSizeMultiplier,
|
size: valueToRender.length * inputSizeMultiplier,
|
||||||
readOnly,
|
readOnly,
|
||||||
onChange: e => this.handleChange(e.target.value),
|
onChange: e => this.handleChange(e.target.value),
|
||||||
ref: inputRef,
|
ref: inputRef,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user