Bugfix: List with basic string should call onChange

This commit is contained in:
Cássio Zen 2017-01-16 16:52:24 -02:00
parent 63ae669507
commit 7b755d5839

View File

@ -60,14 +60,17 @@ export default class ListControl extends Component {
}
handleChange = (e) => {
const { onChange } = this.props;
const oldValue = this.state.value;
const newValue = e.target.value;
const listValue = e.target.value.split(',');
if (newValue.match(/,$/) && oldValue.match(/, $/)) {
listValue.pop();
}
this.setState({ value: valueToString(listValue) });
const parsedValue = valueToString(listValue);
this.setState({ value: parsedValue });
onChange(listValue.map(val => val.trim()));
};
handleCleanup = (e) => {