1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-29 00:58:03 +02:00

WIP fix wrong input fields bug

This commit is contained in:
Tim Daubenschütz 2015-09-18 14:50:08 +02:00
parent 2cbf7d0095
commit e05249eacb

View File

@ -15,10 +15,32 @@ let InputTextAreaToggable = React.createClass({
getInitialState() {
return {
value: this.props.defaultValue
value: null
};
},
componentDidUpdate(prevProps, prevState) {
if(this.state.value !== prevState.value) {
this.handleChange({
target: {
value: this.state.value
}
});
}
if(!this.state.value && this.props.defaultValue) {
this.handleChange({
target: {
value: this.props.defaultValue
}
});
}
},
componentWillUnmount() {
this.setState({value: null});
},
handleChange(event) {
this.setState({value: event.target.value});
this.props.onChange(event);