fix value clear

This commit is contained in:
SpikeHD
2022-05-16 17:20:19 -07:00
parent 0a37529b17
commit 38b4ab4f5d
2 changed files with 7 additions and 1 deletions

View File

@@ -62,7 +62,11 @@ export default class DirInput extends React.Component<IProps, IState> {
render() {
return (
<div className='DirInput'>
<TextInput value={this.state.value} placeholder={this.state.placeholder} readOnly={true} />
<TextInput value={this.state.value} placeholder={this.state.placeholder} readOnly={true} onChange={(text: string) => {
this.setState({ value: text })
if (this.props.onChange) this.props.onChange(text)
}}/>
<div className="FileSelectIcon" onClick={this.handleIconClick}>
<img src={File} />
</div>

View File

@@ -44,6 +44,8 @@ export default class TextInput extends React.Component<IProps, IState> {
}} />
<div className="TextClear" onClick={() => {
this.setState({ value: '' })
if (this.props.onChange) this.props.onChange('')
}}>
<img src={Close} className="TextInputClear" />
</div>