Unfortunately the Material UI Dropzone library doesn't give you access to have multiple snack bar alerts, but you can achieve this using the onDrop
property and a customized snackbar library (you can use the one from the material example - at the bottom of the snackbars page there is an example on using the notistack lib: https://material-ui.com/components/snackbars/).
A few notes:
- You need to remove the
getFileAddedMessage
method (you are not going to use it).
- You need to set
showAlerts
to false
(because you manage the alerts manually and not using the Material UI Dropzone lib.
Here is an example of the DropzoneArea:
<DropzoneArea
acceptedFiles={["image/*", "video/*", "application/*"]}
onChange={this.handleChange.bind(this)}
showFileNames
filesLimit={20}
showAlerts={false}
onDrop={e => {
e.forEach(item => this.props.enqueueSnackbar(item.name));
}}
/>
You can see a working example here: https://codesandbox.io/s/mui-material-dropzone-multiple-snackbars-54rij?file=/src/index.js