material-ui-dropzone
material-ui-dropzone copied to clipboard
initialFiles doesn't work in dialog
initialFiles doesn't work when there are another files
I use DropzoneDialog, but initial files doesn't work
#87 and #192 have similar issue I am using DropzoneDialogbecause the user requirement was shown to him, what happens is that I am sending those files when a specific form finishes, but he can open the dialog as many times as necessary.
I have a function that receives the files and reloads them and I use usestate
to receive the files
const [files, setFiles] = useState(value);
let f
const arr = []
files.map((file) =>{
f = new File([file.name],file.name,{type:file.type ,lastModified:file.lastModified})
return arr.push(f)
})
after , when the dialog 'save' work in console but when charge this state doesnt work
<DropzoneDialog
inputProps={{name:name}}
cancelButtonText={"Cancelar"}
submitButtonText={"Subir archivos"}
dropzoneText={"Arrastre o seleccione los archivos, máximo 6MB "}
dialogTitle={"Insertar archivo"}
getFileAddedMessage={(fileName) =>
`Archivo ${fileName} Agregado correctamente.`
}
getFileRemovedMessage={(fileName) =>
`Archivo ${fileName} Removido correctamente.`
}
getFileLimitExceedMessage={(filesLimit) =>
`El archivo supera el tamaño máximo permitido.`
}
maxFileSize={6000000}
open={open}
onClose={() => setOpen(false)}
onSave={(files) => {
onChange(name,files)
setFiles(filesSave => filesSave.concat(files));
setOpen(false);
}}
initialFiles = {[...arr]}
//onChange={(files) => onChange(files)}
showPreviews={true}
showFileNamesInPreview={true}
/>
How can I reload the files until the form actually ends?