React-toastify: css doesn't work in 3.1.0

Created on 14 Dec 2017  路  15Comments  路  Source: fkhadra/react-toastify

setting css with glamor doesn't work in 3.1.0, tried the example in document, no effect at all.

bug

Most helpful comment

marvellous, this saved my life thanks @fkhadra

All 15 comments

Hey @yq314 ,

Could you share a sample ? It will be easier to troubleshoot.

Thanks

Hi @fkhadra ,

I just ran a simple react app with this code:

 import React from 'react';
 import { ToastContainer, toast } from 'react-toastify';
 import { css } from 'glamor';

 class App extends React.Component {
     closeAfter15 = () => toast("YOLO", { autoClose: 15000, className: css({
         background: "black"
       }) });

     closeAfter7 = () => toast("7 Kingdoms", { autoClose: 15000 })

     render(){
         return (
             <div>
             <button onClick={this.closeAfter15}>Close after 15 seconds</button>
             <button onClick={this.closeAfter7}>Close after 7 seconds</button>
             <ToastContainer autoClose={8000} />
             </div>
         );
     }
 }

 export default App;

click on the two buttons trigger the same toast with the default color, however the first one is supposed to be black.

@yq314 you have to use backgroundColor instead of background. My mistake, I'll fix the doc right now.

Here is a working snippet:
Edit React-toastify fix issue #103

@yq314 I updated the doc btw 馃榿

react toastify fix issue 103 codesandbox
The CodeSandbox example doesn't seem to work for me?

I'm using Chrome 62.0.3202.94 btw

We are using the same version. It's working for me. Could you try to refresh ? Maybe a cache issue.
image

hmm, so weird, I cleared cache still no luck, tried in incognito mode also same...

it doesn't work for me on both my PC and Mac...

I'll try with create-react-app to see what's going on

Css rules are not merged correctly.

@yq314 got a fix. I'll let you know when it's live

thanks for the quick action! @fkhadra

@yq314 the new release is live 馃殌

marvellous, this saved my life thanks @fkhadra

Was this page helpful?
0 / 5 - 0 ratings