I am trying to stop my application from returning to the previous screen when a modal is present. This currently closes the modal but also exits the existing page and returns home.
Any ideas on how to stop this from happening ?
document.addEventListener('backbutton', function(e) {
  if(modalIsOpen === true) {
    e.preventDefault();
    setIsOpen(false);
  }
});