Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initialFiles doesn't work in dialog #313

Open
santilp95 opened this issue Jul 1, 2021 · 0 comments
Open

initialFiles doesn't work in dialog #313

santilp95 opened this issue Jul 1, 2021 · 0 comments

Comments

@santilp95
Copy link

santilp95 commented Jul 1, 2021

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?

@santilp95 santilp95 changed the title initialFiles doesn't work initialFiles doesn't work in dialog Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant