adjusting the ref type for the snackbar provider
This commit is contained in:
parent
2fc25431bd
commit
77f0f778a3
1 changed files with 5 additions and 4 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import { Button, Theme } from "@mui/material";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import {
|
||||
ProviderContext as NotistackProviderContext,
|
||||
SnackbarAction,
|
||||
SnackbarProvider as NotistackSnackbarProvider,
|
||||
useSnackbar as useNotistackSnackbar
|
||||
|
|
@ -95,15 +94,17 @@ function SnackbarHelper(props: PropsWithChildren<Props>) {
|
|||
export default function SnackbarProvider(props: PropsWithChildren<Props>) {
|
||||
const { children } = props;
|
||||
const classes = useStyles();
|
||||
const notistackRef = React.createRef<NotistackProviderContext>();
|
||||
const providerRef = React.createRef<NotistackSnackbarProvider>();
|
||||
|
||||
const onClickDismiss = (key: React.ReactText) => () => {
|
||||
if (notistackRef && notistackRef.current) notistackRef.current.closeSnackbar(key);
|
||||
if (providerRef && providerRef.current) {
|
||||
providerRef.current.closeSnackbar(key);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<NotistackSnackbarProvider
|
||||
// ref={notistackRef}
|
||||
ref={providerRef}
|
||||
maxSnack={1}
|
||||
anchorOrigin={{
|
||||
vertical: "bottom",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue