-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Dismiss button effect to closing all snackbars #219
Comments
The "key" paramater will be passed to onClose callback function as a part of this: #214
As a side effect onClose calllback function is fired one more time. |
Thanks @nildakuzu for your contribution. That is not true.
This is expected. Say we have 3 snackbars on the screen; you dismiss one of them using a "Dismiss" button; the moment you click on the button, The only way that I can think of is to pass the props.enqueueSnackbar('my message', {
onClose: (event, reason) => {
if (reason === 'clickaway') {
props.closeSnackbar();
}
if (reason === undefined) {
// you/user closed the snackbar
}
},
}); NOTE: In future |
I want to add that when I click on screen anywhere with mause, all snackbars will close.
I can do this with your onClose callback function when I click anywhere in screen, it will works fine. However, when I close single snackbar with dismiss button, it also close all snackbars.
How can I detect this situtations ?
My code is below,
When I use onClose callback method
public render() {
const notistackRef = React.createRef();
const onClickDismiss = key => () => {
(notistackRef.current as any).closeSnackbar(key);
};
}
}
The text was updated successfully, but these errors were encountered: