Allow contract value to be cleared (#1997)

This commit is contained in:
mwbailey 2018-07-06 12:08:27 -07:00 committed by Daniel Ternyak
parent 062d25145c
commit fbe792a58f
2 changed files with 9 additions and 3 deletions

View File

@ -9,7 +9,7 @@ interface Props extends ReactSelectProps {
export default class Dropdown extends React.Component<Props> {
public state = {
selectedOption: { value: '', label: '' },
selectedOption: { value: undefined, label: '' },
hasBlurred: false
};
@ -43,13 +43,13 @@ export default class Dropdown extends React.Component<Props> {
});
}
}}
{...this.props}
className={`${this.props.className} ${this.state.hasBlurred ? 'has-blurred' : ''}`}
value={value}
onChange={obj => {
this.handleChange(obj as any);
onChange();
onChange(obj as any);
}}
{...this.props}
onBlur={e => {
this.setState({ hasBlurred: true });
if (this.props && this.props.onBlur) {

View File

@ -195,6 +195,12 @@ class InteractForm extends Component<Props, State> {
abiJson: fullContract.abi || '',
contract
});
} else {
this.props.setCurrentTo('');
this.setState({
abiJson: '',
contract
});
}
};