dir options setting and default vlaue

This commit is contained in:
SpikeHD
2022-05-12 23:00:49 -07:00
parent 82b92dab45
commit 7b908bd311
2 changed files with 27 additions and 3 deletions

View File

@@ -28,6 +28,12 @@ export default class DirInput extends React.Component<IProps, IState> {
this.handleIconClick = this.handleIconClick.bind(this)
}
static getDerivedStateFromProps(props: IProps, state: IState) {
if (!props.value || state.value !== '') return state
return { value: props.value || '' }
}
async componentDidMount() {
const translation = await translate('components.select_file')
this.setState( {