Skip to content
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

Does ToastContainer listen to theme props and auto rerender? #1100

Open
JobberRT opened this issue Apr 19, 2024 · 1 comment
Open

Does ToastContainer listen to theme props and auto rerender? #1100

JobberRT opened this issue Apr 19, 2024 · 1 comment

Comments

@JobberRT
Copy link

JobberRT commented Apr 19, 2024

I have a usage like this:

const [darkMode, setDarkMode] = useState(false)
<ToastContainer autoClose={false} closeOnClick newestOnTop limit={5} theme={darkMode ? "dark" : "colored"} />

Example condition

At default, darkMode is false, so the ToastContainer is theme=colored. A toast is created and will not auto close(For example, a "You Got A New Message" toast). Later, darkMode is changed(by user or by system time), the created toast will not rerender itself to dark like other component, it will keep as a colored toast, only newly created toast will apply the new dark value.

Does toastify listen to theme change and rerender the toast? If not, will this feature be added?

@JobberRT
Copy link
Author

I know there's a toast.update() function that I can use, but that will require the darkMode to be passed to every sub components(and their sub components too), and use it like

useEffect(()=>{toast.update(toastId, {theme: <THE CONDITION>})},[darkMode])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant