mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +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() {
|
getInitialState() {
|
||||||
return {
|
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) {
|
handleChange(event) {
|
||||||
this.setState({value: event.target.value});
|
this.setState({value: event.target.value});
|
||||||
this.props.onChange(event);
|
this.props.onChange(event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user