Topic: Call function on modal exit when clicking outside of modal

jliburd free asked 5 years ago


Expected behavior I want to call a function on modal exit when the user closes the modal by clicking outside of the modal. What event should I listen for when the user clicks outside of the modal?

Actual behavior The modal exits but my function is not called.

Resources (screenshots, code snippets etc.)


Aliaksandr Andrasiuk staff answered 5 years ago


Hi,

There is a hiddenModal method which will fires after the modal is closed:

<MDBModal ... hiddenModal={() => console.log('closed')}>

Also, there is a hideModal which fires just before the modal is hidden.

You can find more methods in our documentation. On the top of the page click on the API tab and you will see all the properties and methods you can use with Modal component.

Hope I could help.

Best regards.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.19.0
  • Device: computer
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No