-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
notistack doesn't work well with createGenerateClassName in StylesProvider #389
Comments
I'm experiencing the same problem when pass custom jss instance to const cache = React.useMemo(() => createCache({ key: 'BRAND', container: emotionRoot }), []);
const jss = React.useMemo(() => create({ ...jssPreset(), insertionPoint: elementRoot }), []);
return (
<CacheProvider value={cache}>
<StylesProvider jss={jss} injectFirst>
<ThemeProvider theme={theme}>
<SnackbarProvider style={{ pointerEvents: 'all' }}>
<CssBaseline>
<GlobalStyles styles={{ b: { fontWeight: 600 }, strong: { fontWeight: 600 } }} />
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
</CssBaseline>
</SnackbarProvider>
</ThemeProvider>
</StylesProvider>
</CacheProvider>
); My use case is to render the whole react app under shadow root, i have to insert style tag inside the shadow-root instead of the head. the trick |
revert to 1.0.5 works. anything important changed between 1.0.5 and 1.09? |
I found a temporary solution by using custom className.
and
The action button can be clicked and snackbars have 6px margin on the top and the bottom. |
Hello, I have the same issue as you. I use Putting I hope this can be fixed in a future version :) |
We are experiencing the same issue. I guess it has something to do with the latest changes to notistack/src/SnackbarContainer.tsx Lines 7 to 10 in f188d2b
|
We have the same here the code is pretty much <ThemeProvider theme={createTheme()}>
<SnackbarProvider>
<CssBaseline />
<div />
</SnackbarProvider>
</ThemeProvider> no have to revert to 1.0.6 for now |
* Add goober * Use goober for SnackbarContainer * Use goober from SnackbarContent * Convert Snackbar component to Typescript * Add material design content * Process props and pass to custom snackbar * No spreading * Reuse enqueueSnackbar type * Add WIP migration guide * Add tslib to devDep * Remove duplicate eslintrc * Render SnackbarContainer children * Default content should forwardRef * Fix bug with collapse classes * Don't drop support for `content` prop just yet * Remove duplicate className * Use useSnackbar in the basic example * Update Migration md * Add links to the right section * No memo for SnackbarContent * Bump version to v2 * 2.0.1-alpha.0 * Update typedoc.json * No imports from outside in index.d.ts * 2.0.1-alpha.1 * Update typedoc.json * Ensure CustomSnackbarProps type is accurate * Use Generics for Variant * 2.0.1-alpha.2 * Minor * Add more strict types * 2.0.1-alpha.3 * Get message from options only * Move minWidth to snackbar for easier customisation * Add MIGRATION to npmignore * Make intellisense happy * Apply Collapse customisation in SnackbarContainer * Fix various issues with Container component * Add default background color * Add ComponentClasses * Update typedoc.json * 2.0.1-alpha.4 * [alpha] Add .bind(this) to method stored in provider state (#397) * Fix easy linting issues * Import types from types.ts file * Fix bind.this * Fix collapse selectors * Update package-lock * 2.0.1-alpha.5 * Fix ts-ignore * v3.0.0-alpha.1 * Use clickaway component * Add useForkRef * Rename class keys * Use internal svg icon * Use internal transition components * Fixes #396 #389 - Do not use css selectors for Collapse component * Add useCallbackNormaliser * Update SnackbarProvider types * Use internal Collapse component * Add transition utils * Rename close reason * Update types * Remove MUI dependency * Move transitions into their directory * Improve transition import paths * Add react-transition-group types * Update import paths for ui components * Add index export * Move useForkRef * Move SnackbarContainer * Update path to SnackbarProvider * Update possible transition components * Default to MaterialDesignContent in SnackbarItem * Move util functions to the relevant file * Move warning messages to the relevant file * Remove CloseReason constant * Improve merge helper function * Move merger into its own file * Rename file and update import paths * Update docs * Add np as publisher * Update published main path * Copy files to dist folder * Add np * No github drafter * Add npm scripts * Add custom component example * Update indentation from 4 to 2 spaces * Add readme * Add readme with codesandbox button * Remove react-transition-group dep * Add internal transition component * Fix bug with warning logger * SnackbarItem don't add snackbarid as arg to transition callbacks * Minor * Simplify transition logic by removing useCallbackNormaliser * Update migration guide * Add `id` to transition props * Update typedoc * 3.0.0-alpha.2 * Minor change * Update link codesandbox example * Export transitions * Remove fontFamily stylings * Update variant types * Regenerate doc defs * Move types in one file * Regenerate docs * Ignore prettier config * enforce node engine * Support react 18 * Remove yolo * Update np version * Update docs * Copy package.json before packing * Rename lifecycle script * Add postversion script * Fix typo * v3.0.0-alpha.3 * Minor * Update links to notistack website * Minor * Add second custom example * Add report complete example * Update report complete example * Update alpha engine versions (#497) Co-authored-by: Antti Ahti <[email protected]> * Update jsdocs * v3.0.0-alpha.4 * Fixes #495 - FIx all snackbars closing at the same time (#498) * v3.0.0-alpha.5 * Use a more simple Collapse * Remove getAutoHeightDuration as a file * Update eslint config * Run eslint fix * Remove ClickAway listener * Minor * Convert transition component to TS * Move TransitionStatus type * Remove transitions * Export Transition component * Update types to export Transition component * Address ts errors * Move cp commands to package.json * Update scripts * Add test script * Update np config * v3.0.0-alpha.6 * Update banner image to be served from docs website * Add support for displaying Snackbars outside of the component (#499) * Add support for displaying snackbars outside of the component * Update README instructions * Update MIGRATION.md * Remove withSnackbar HOC (#500) * Convert JS files to TS * v3.0.0-alpha.7 * Closes #501 - Remove clickaway from docs * Fixes #513 - Ensure MUI transitions continue to work (#518) * Update transition types * Ensure MUI transitions continue to work * Update typedocs * v3.0.0-alpha.8 * Add render function SnackbarProvider * v3.0.0-alpha.9 * Update typedocs * v3.0.0-alpha.10 * Closes #521 - Update SnackbarContent to accept ref type * v3.0.0-alpha.11 * Allow overriding styles of Material Snackbar (#545) * Pass className down to snackbar content * Add MuiContent-variant classname * Export MaterialDesignContent component * Update typedocs * Minor * v3.0.0-alpha.12 * v3.0.0-alpha.13 * Update CHANGELOG.md * Update README.md --------- Co-authored-by: Anthony Raymond <[email protected]> Co-authored-by: Antti Ahti <[email protected]> Co-authored-by: Antti Ahti <[email protected]>
Hello, notistack is a great library. It helps us a lot.
Anyway, I found that notistack styles look broken if I use
createGenerateClassName
with Material-UI's StylesProvider.margins are gone and the action button cannot be clicked.
Expected Behavior
snackbars have proper margins and enable to click the button.
Current Behavior
The snackbars cannot be clicked and shown closely with the prev/next stackbars.
Steps to Reproduce
Context
It worked well in v0.9.17.
And also it works well in v1.0.9 when I move SnackbarProvider to outside of StylesProvider.
Your Environment
Many thanks!
The text was updated successfully, but these errors were encountered: