juliancwirko / react-s-alert

Alerts / Notifications for React with rich configuration options
https://www.npmjs.com/package/react-s-alert
MIT License
649 stars 75 forks source link

Alert not disappearing on timeout #12

Closed minfawang closed 7 years ago

minfawang commented 8 years ago

You can see from the GIF the alert stays in the screen forever. I'm using the latest version (1.1.2). Is that a bug? alert-error

juliancwirko commented 8 years ago

Hi, this is weird, is it working in the app? Not in the console. I'm curious, how do you run it in the console. How do you get the 'Alert' object here? It should be imported in the React app.

minfawang commented 8 years ago

Oh I just import the Alert object and append it in the global namespace. Something like

import Alert from 'react-s-alert';
class MyComp extends React.Components {
  render() {
    global.Alert = Alert; // <-- So it's available in the console.
    // ...
  }
}

It's the same as running in the app... Do you need any other information?

juliancwirko commented 8 years ago

Hmmm, I don't think that it will work like that. Basically what you need to do is to place component somewhere in your main app component (in render) and then make calls like Alert.warning(...) etc. In the app it works well for me. You can check out the demo App source code for more information: https://github.com/juliancwirko/react-s-alert-demo

What is important:

This line and calls to the Alert

minfawang commented 8 years ago

Yes. I have placed an <Alert /> element in the root of the app. It used to work before (like two weeks ago). I think only one <Alert /> element for the whole app is enough, right?

juliancwirko commented 8 years ago

Yes, it should be one component, but you need to be sure that it is always available. I cann't reproduce that bug :/ Can you test it on version 1.1.0 or maybe 1.0.0? Or maybe you can create a small reproduction repository?

minfawang commented 8 years ago

Let me try to create a reproduction! First thank you for your help. Really appreciate it!

juliancwirko commented 8 years ago

Ok, that would be awesome :)

zhaoyao91 commented 8 years ago

Hi, I encountered this problem in some apps too! fortunately one of them is a demo app and the code is in github, and there is even an online demo of this app so you can try to reproduce the problem right now (you can use username bob and password 123). I cannot ensure this online demo will last for long time, but you can always run this meteor project locally to test. By my experience, it rarely happens on PC, but often occurs on my galaxy s7 edge browser.

juliancwirko commented 7 years ago

Hey, I'll close it for now, if someone have good reproduction repo let me know.

zentuit commented 7 years ago

I'm seeing the same thing -- I don't have a good reproduction repo, but I've traced it and see that after the handleCloseAlert function has finished, the render is not fired again. In my particular case, the close button looks unresponsive; but in reality the handleCloseAlert fires and finishes also without the re-rendering.

I have 3 different components that use Alerts, but only 1 is displaying this behavior. If I find anything else out, I'll let you know.

Update: Seems that for this one Alert, the webkitAnimationEnd/animationend events are not firing so the REMOVE action is not dispatched.