ajoute un debounce aux champs du simulateur"

pull/512/head
Johan Girod 2019-04-10 12:24:48 +02:00
parent 9bec4d55c6
commit e13f48d535
2 changed files with 5 additions and 7 deletions

View File

@ -14,14 +14,10 @@ let isCurrencyPrefixed = language =>
class CurrencyInput extends Component {
state = {
value: null
value: this.props.defaultValue
}
onChange = debounce(this.props.debounce, this.props.onChange)
static getDerivedStateFromProps(props, state) {
return {
value: state.value === null ? props.value : state.value
}
}
getSnapshotBeforeUpdate = () => {
return this.input.selectionStart
}
@ -63,7 +59,7 @@ class CurrencyInput extends Component {
render() {
let forwardedProps = dissoc(
['onChange', 'value', 'language', 'className'],
['onChange', 'defaultValue', 'language', 'className', 'defaultValue'],
this.props
)

View File

@ -224,6 +224,8 @@ let CurrencyField = withColours(props => {
}}
debounce={600}
className="targetInput"
key={props.input.value}
defaultValue={props.input.value}
{...props.input}
{...props}
/>