Allow contract value to be cleared (#1997)
This commit is contained in:
parent
062d25145c
commit
fbe792a58f
|
@ -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) {
|
||||
|
|
|
@ -195,6 +195,12 @@ class InteractForm extends Component<Props, State> {
|
|||
abiJson: fullContract.abi || '',
|
||||
contract
|
||||
});
|
||||
} else {
|
||||
this.props.setCurrentTo('');
|
||||
this.setState({
|
||||
abiJson: '',
|
||||
contract
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue