Closed keul closed 5 years ago
Snackbars item opened by notistack should not change the global theme, and it's not doing it, but documentation can lead users to wrong nesting.
Take the codesanbox link below. I'm more or less reproducing what docs says:
<SnackbarProvider maxSnack={3}> <App /> </SnackbarProvider>
...but I've also a custom ThemeProvider
ThemeProvider
https://codesandbox.io/s/notistack-issue-3673u
The issue is easily fixable: the SnackbarProvider component should be wrapped inside the custom ThemeProvider, but documentation is not helping.
SnackbarProvider
I think that a clear indication about this can save debug time or issue report.
Thanks @keul ❤️ The following line has been added to the docs website:
Note: If you're using material-ui ThemeProvider, make sure SnackbarProvider is a child of it.
Hopefully it be useful in future.
Expected Behavior
Snackbars item opened by notistack should not change the global theme, and it's not doing it, but documentation can lead users to wrong nesting.
Steps to Reproduce
Take the codesanbox link below. I'm more or less reproducing what docs says:
...but I've also a custom
ThemeProvider
https://codesandbox.io/s/notistack-issue-3673u
Context
The issue is easily fixable: the
SnackbarProvider
component should be wrapped inside the customThemeProvider
, but documentation is not helping.I think that a clear indication about this can save debug time or issue report.