added onInputFileHandler

This commit is contained in:
Artem Tarasov 2020-07-23 16:26:32 +03:00
parent 8fd658ced9
commit 5bf6f7de50
2 changed files with 16 additions and 9 deletions

View File

@ -384,6 +384,8 @@ class Body extends Component {
onContinueHandler = () => {
const valid = this.checkingValid();
console.log(this.state.file)
if (valid) {
const { setPortalOwner, wizardToken } = this.props;
const { password, email,
@ -453,6 +455,12 @@ class Body extends Component {
}});
}
onInputFileHandler = file => {
this.setState({
file: file
})
}
renderModalDialog = () => {
const { errorLoading, visibleModal, errorMessage } = this.state;
const { t, isOwner, ownerEmail } = this.props;
@ -547,9 +555,7 @@ class Body extends Component {
placeholder={t('placeholderLicense')}
size="large"
scale={true}
onInput={(file) => {
console.log(`name: ${file.name}`, `lastModified: ${file.lastModifiedDate}`, `size: ${file.size}`);
}}
onInput={this.onInputFileHandler}
/>
</Box>
: null;

View File

@ -87,7 +87,8 @@ class FileInput extends Component {
this.inputRef = React.createRef();
this.state = {
fileName: ''
fileName: '',
file: null
}
}
@ -116,13 +117,13 @@ class FileInput extends Component {
if ( this.inputRef.current.files.length > 0 ) {
this.setState({
fileName: this.inputRef.current.files[0].name
fileName: this.inputRef.current.files[0].name,
file: this.inputRef.current.files[0]
}, () => {
if(onInput) onInput(this.state.file);
});
if(onInput) onInput(this.inputRef.current.files[0]);
} else {
this.setState({ fileName: '' })
}
}
}
render() {