React-toastify: Two toasts opening after updating to latest version

Created on 9 Jan 2018  路  2Comments  路  Source: fkhadra/react-toastify

Hi, I decided to update the react-toastify in my project(to the latest version). After that, when I open a toast for some reason it opens a wrong toast (considering the style i set up) over my styled toast.

wrong

The image above shows the wrong toast, it appears on top of the right one, when i click on it, it disappears and the right one now is visible.

right

The other image is the right toast that i want to show to the user.I'll put below my code to the function that calls the toast.

 showAlert(title, msg) {
   const Msg = () =>
                 <Fragment>
                   <div className='col s12 modal-labels'>
                     <label className='modal-label-1'>{title}</label>
                   </div>
                   <div>
                     <label className='modal-label-2'>{msg}</label>
                   </div>
                 </Fragment>

     const options = {
       autoClose: 5000,
       type: toast.TYPE.INFO,
       hideProgressBar: false,
       closeButton: false,
       className: css({
         backgroundColor: '#EFEBE9'
       }),
       bodyClassName: css({
         height: '150px',
         border: 'none',
         backgroundColor: '#EFEBE9'
       })
     }
     toast.info(<Msg func={toast.dismiss}/>, options)
  }

I checked and this function is only called once, so it should render only one toast.
I hope you can help me,
Thanks

question

Most helpful comment

Hey, so sorry. I didnt pay attention to the fact that I had two toast containers. That was the problem! Thanks, seeing your code working made me realize the problem was somewhere else!

All 2 comments

Hey @gabrielHosino,

Could you help me to reproduce the issue here:
Edit pypzllo62x

I replaced Fragment by div cause codesandbox is running react 16 not 16.2

Hey, so sorry. I didnt pay attention to the fact that I had two toast containers. That was the problem! Thanks, seeing your code working made me realize the problem was somewhere else!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LouisCuvelier picture LouisCuvelier  路  3Comments

SmileSydney picture SmileSydney  路  4Comments

spiritedfang picture spiritedfang  路  3Comments

AiBaby19 picture AiBaby19  路  4Comments

jorgecuesta picture jorgecuesta  路  5Comments