Browse Source

Merge pull request #1459 from juan-cortes/issue-1457

Cancel empty onChange events for InputCurrency components
master
Meriadec Pillet 7 years ago
committed by GitHub
parent
commit
47db21b04b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/components/base/InputCurrency/index.js

4
src/components/base/InputCurrency/index.js

@ -172,7 +172,7 @@ class InputCurrency extends PureComponent<Props, State> {
renderListUnits = () => { renderListUnits = () => {
const { units, onChangeUnit, unit } = this.props const { units, onChangeUnit, unit } = this.props
const { isFocused } = this.state const { isFocused } = this.state
const avoidEmptyValue = value => value && onChangeUnit(value)
if (units.length <= 1) { if (units.length <= 1) {
return null return null
} }
@ -180,7 +180,7 @@ class InputCurrency extends PureComponent<Props, State> {
return ( return (
<Currencies onClick={stopPropagation}> <Currencies onClick={stopPropagation}>
<Select <Select
onChange={onChangeUnit} onChange={avoidEmptyValue}
options={units} options={units}
value={unit} value={unit}
getOptionValue={unitGetOptionValue} getOptionValue={unitGetOptionValue}

Loading…
Cancel
Save