negomi / react-burger-menu

:hamburger: An off-canvas sidebar component with a collection of effects and styles using CSS transitions and SVG path animations
http://negomi.github.io/react-burger-menu/
MIT License
5.05k stars 586 forks source link

Show Confirm before close #347

Closed 0xori closed 4 years ago

0xori commented 5 years ago

Hi, I'm trying to show a confirm that will prevent the menu to close on overlay click. I tried to use the onStateChange to show a confirm, but it's called after the internal state has already changed. Is there anything like onBeforeStateChange or onOverlayClick that can prevent the internal state change? Is it possible that the menu state will be 100% controlled? because right now the overlay click is managed internally.

negomi commented 5 years ago

Hi @0xori, yep, there isn't anything like onBeforeStateChange unfortunately. There is disableOverlayClick, which can accept a function - you might be able to get somewhere with that depending on what you're trying to do.

behnazbgh commented 4 years ago

Hi @0xori, did you manage to find a way for this issue? actually I am having same issue. thanks for helping

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

negomi commented 4 years ago

https://github.com/negomi/react-burger-menu/issues/387 provides a solution to this problem. Change available in 2.7.0