mirror of
https://github.com/ascribe/onion.git
synced 2025-01-08 20:55:59 +01:00
WIP fix wrong input fields bug
This commit is contained in:
parent
2cbf7d0095
commit
e05249eacb
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user