fkhadra/react-toastify

css doesn't work in 3.1.0

yq314 opened this issue ยท 15 comments

yq314 commented

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

Hey @yq314 ,

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

Thanks

yq314 commented

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 ๐Ÿ˜

yq314 commented

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

yq314 commented

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

yq314 commented

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

yq314 commented

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

yq314 commented

thanks for the quick action! @fkhadra

@yq314 the new release is live ๐Ÿš€

yq314 commented

marvellous, this saved my life thanks @fkhadra