react-dropzone-uploader icon indicating copy to clipboard operation
react-dropzone-uploader copied to clipboard

how I can reset my component Dropzone whit state?

Open christiantigre opened this issue 5 years ago • 8 comments

how I can reset my component Dropzone whit state? My state is

this.state = {
  files : [],
}

My component is

<Dropzone
getUploadParams={this.getUploadParams}
onChangeStatus={this.handleChangeStatus}
onSubmit={this.handleSubmitUploadFile}
initialFiles={this.state.files || ''}
accept=".XLS,.XLSX"
inputContent={(files, extra) => (extra.reject ? 'Archivos' : 'Arrastrar archivo')}
canRestart={true}
canCancel={true}
canRemove={true}
multiple={false}
maxFiles={1}
maxSizeBytes={(1024 * 1024) * 6}
/>

But I need to reset it from a button, using the event onClick

My botton is

<Button size="sm" color="danger" onClick={this.resetFormImport}><i className="fa fa-ban"></i> Reset</Button>

Reset I try to update my state to refresh the component but it doesn't give any results.

resetFormImport() {
    this.setState({
         files : [],
    })
}

Some solution??

how I can reset the component??

christiantigre avatar Sep 20 '19 20:09 christiantigre

Good catch. I think this could be due to the CSS margin. Will work on a fix in the js function.

shahednasser avatar Sep 07 '20 14:09 shahednasser

Yes I think so, I will fix it in the js function

isonnymichael avatar Sep 07 '20 14:09 isonnymichael

alright great!

shahednasser avatar Sep 07 '20 15:09 shahednasser

Resolved by #46

shahednasser avatar Sep 07 '20 16:09 shahednasser