diff --git a/source/components/CurrencyInput/CurrencyInput.js b/source/components/CurrencyInput/CurrencyInput.js index 649479c3d..1f9d20f7d 100644 --- a/source/components/CurrencyInput/CurrencyInput.js +++ b/source/components/CurrencyInput/CurrencyInput.js @@ -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 ) diff --git a/source/components/TargetSelection.js b/source/components/TargetSelection.js index 68f3f2b3f..70b776357 100644 --- a/source/components/TargetSelection.js +++ b/source/components/TargetSelection.js @@ -224,6 +224,8 @@ let CurrencyField = withColours(props => { }} debounce={600} className="targetInput" + key={props.input.value} + defaultValue={props.input.value} {...props.input} {...props} />