schiehll / react-alert

alerts for React
MIT License
608 stars 98 forks source link

[Enhancement] Pause timeout when cursor hovering alert #144

Closed orditeck closed 3 years ago

orditeck commented 4 years ago

Hi, thanks for the nice lib.

It'd be a nice feature if the timeout could be paused when the cursor is hovering the alert.

besLisbeth commented 4 years ago

Hi @orditeck. It's easily can be done, just adding the events listeners onMouseEnter, onMouseLeave to the alert template

ShannonLCapper commented 3 years ago

I was wondering if I could get some clarity on what needs to be called in the onMouseEnter and onMouseLeave handlers in the alert template in order to pause the timeout? As far as I can tell, the only option is to omit the timeout option completely and implement a custom one inside the alert template that calls close directly. Is that correct?

besLisbeth commented 3 years ago

Hi @ShannonLCapper, yes it's totally correct. It may be not the best implementation, but it's the working one. I use such construction in one of my projects.