ajoute un debounce aux champs du simulateur"
parent
9bec4d55c6
commit
e13f48d535
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
@ -224,6 +224,8 @@ let CurrencyField = withColours(props => {
|
|||
}}
|
||||
debounce={600}
|
||||
className="targetInput"
|
||||
key={props.input.value}
|
||||
defaultValue={props.input.value}
|
||||
{...props.input}
|
||||
{...props}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue