Closed kishieel closed 2 years ago
Works like a charm #342
const WrappedToastContainer = (props) => {
return (
<div {...props}>
<ToastContainer
closeOnClick: true,
pauseOnHover: true,
theme: "colored"
/>
</div>
)
}
const ToastContainerStyled = styled(WrappedToastContainer)`
.Toastify__toast-container {
/* style for default container - in docs not wrapped inside any class */
}
.Toastify__toast-theme--colored.Toastify__toast--success {
background: ${({theme}) => theme.backgroundToastSuccess};
}
.Toastify__toast-theme--colored.Toastify__toast--warning {
background: ${({theme}) => theme.backgroundToastWarning};
}
/* etc. */
`;
Issue
Hi, I am wondering about possibility of theming colored toast with
ThemeProvider
from "styled-components". Due to exisitingtheme
property onToastConteiner
when I am trying to fetch some theme settings for toast I meet withtheme
fromToastContainer
overlaps mytheme
property fromThemeProvider
.What I want?
I would like to be able to theme a colored toast with the styled-components theme provider. Below is a sandbox presenting my issue:
Demo
https://codesandbox.io/s/long-breeze-ukibc?file=/src/App.js
Setup