Farzin-Firoozi/react-modern-drawer

Parent drawer intercepting the default onClose handler of child drawer.

Closed this issue · 2 comments

I have an app where I have a drawer rendering in a parent component. This drawer works fine and closes when I click outside the drawer. This parent component has a child component who also has a drawer. When I try closing this drawer by clicking on the overlay in the child component, the parent drawer's onClose function is activated and the child drawer stays open. I confirmed this behavior using a console.log in the parent onClose function.

Is there an easy fix for this, or do I need to find a workaround?

Thank you in advance :)

Would you please attach an example code for that?

@Farzin-Firoozi

I realized my company is running an old version of node still, so it had installed an old version (1.0.1) of react-modern-drawer. This may be the issue. The code sandbox below shows the issue. If you open the Child Drawer you cannot close it.

https://codesandbox.io/s/tender-rui-8dkt8g?file=/src/App.js

Edit:
Seems like it is the old version 1.0.1 causing the issue. The new version works fine, as you can see here:
Sorry to bother 👍
https://codesandbox.io/s/black-frog-ko03li