isDisabled fix

This commit is contained in:
Artem Tarasov 2020-07-17 15:58:28 +03:00
parent e524adc21a
commit 305edd419c

View File

@ -93,6 +93,11 @@ class FileInput extends Component {
} }
onIconFileClick = e => { onIconFileClick = e => {
const { isDisabled } = this.props;
if(isDisabled) {
return false;
}
e.target.blur(); e.target.blur();
this.inputRef.current.click(); this.inputRef.current.click();
} }
@ -104,12 +109,15 @@ class FileInput extends Component {
} }
onInputFile = () => { onInputFile = () => {
const { onInput } = this.props; const { onInput, isDisabled } = this.props;
if ( this.inputRef.current.files ) { if ( this.inputRef.current.files ) {
this.setState({ this.setState({
fileName: this.inputRef.current.files[0].name fileName: this.inputRef.current.files[0].name
}); });
onInput(this.inputRef.current.files[0])
if(onInput) onInput(this.inputRef.current.files[0]);
} else { } else {
this.setState({ this.setState({
fileName: 'file not choose' fileName: 'file not choose'