Notify the Activity layout that the top most Modal was dismissed only
if no other modals are displayed. Currently this event is used as a
`onVisible` event to to the layout. This whole logic can be simplified
when we implement proper screen visibility events.
When ivoking navigation actions such as push, pop etc, instead of
checking modal visibility, check if modal actually contains the given
navigator. This fix alows to change navigation state in screens while
modal is displayed.
When more then one modal was displayed, and dismissAllModals
was called, the top most modal was dismissed until no modals
were visible. This resulted in quirky animation since user saw
all modals getting dismissed.
This commit simply changes to order in which modals are dismissed to
avoid this bug.
Also changed the structure used to store Modals
from a Map based on navigatorId to a stack.
Reason for the change is that screens can be
pushed only to the topmost Modal.