I have bumped into this issue: setState hook does't change state invoking from child
Long story short fix is simple: just add event.stopPropagation() before updating state of modal visibility to false. Thanks everyone
event.stopPropagation()