React-toastify: Toast style is not working correctly

Created on 6 Jul 2018  路  5Comments  路  Source: fkhadra/react-toastify

I installed last version of react-toastify.

When I use simple demo toast:

     toast.error("TEST", {
                position: toast.POSITION.BOTTOM_LEFT
            });

There is not "red" style - see image, why? What is wrong with my code?

In another component I have a <ToastContainer /> container.

image

Most helpful comment

You need to import the CSS file.

import 'react-toastify/dist/ReactToastify.css';

All 5 comments

You need to import the CSS file.

import 'react-toastify/dist/ReactToastify.css';

I import still not working!

Working for me in the development but not after building
Developement Server :
image
After Build In production :
image

I have the same issue.

In my project, I made a new file toast.css and pasted styles from this path: node_modules/react-toastify/dist/ReactToastify.css.

And in my file I import something like this:

import './toast.css';
import 'react-toastify/dist/ReactToastify.css';

Then i can build my app with styles from Toastify.

I have same issue.

No, simply importing css does not help at all.

It seams tricky to add react-toastify to already mature react app.
Seems the only way to make it work is to add it to your react app from very beginning (right after you run create-react-app etc.) with little or none boilerplate code, otherwise it is not working straight out of the box when I try to add it to my blueprintjs or material-ui based app..

Had to switch over to react-toast-notifications
that really worked out of the box with no effort, just plugged it to my already existing code

And react-toast-notifications
is also can be used as a react hook, which is kind of awesome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AllyssonAlas picture AllyssonAlas  路  4Comments

tobiasfriden picture tobiasfriden  路  3Comments

spiritedfang picture spiritedfang  路  3Comments

fkhadra picture fkhadra  路  4Comments

JakubKoralewski picture JakubKoralewski  路  4Comments