Closed karmingc closed 4 years ago
Hey @karmingc,
Yes, I think https://github.com/negomi/react-burger-menu#close-menu-handler should do what you want.
If you use that prop, the menu will not close automatically, but your callback will be called instead so you can handle the close yourself.
Hi @negomi,
Thank you for your response. Seems there's a typescript issue with that specific prop. Upon further reading in FAQ, I decided to use onStateChange={(state) => this.handleStateChange(state)}
which triggers upon state.isOpen === false
.
For e.g.
// closeMenu being a custom func
onStateChange={(state) => {
if (!state.isOpen) {
closeMenu();
}
}}
Hope this helps for further use cases! Thanks for the library as well!
Hi,
I am currently passing custom props down and am wondering if there is any custom props for closing on clicking the overlay. For e.g, for keydown, we have
customOnKeyDown
and I can pass my custom close func.Thanks!