Every time the user change the text in the modal sheet, the modal will dismiss unexpectedly. But this no longer happens after removing Text(demoText), so I guess that it dismissed because the parent view was updated.
Have you tried moving the ModalPresenter one level upper so that it is not affected by the state change? It is one of the reasons why we separate the ModalPresenter and the ModalLink.
The modal will dismiss after the parent view updates, here's a piece of code that can re-create this bug:
Every time the user change the text in the modal sheet, the modal will dismiss unexpectedly. But this no longer happens after removing
Text(demoText)
, so I guess that it dismissed because the parent view was updated.