React Modal Host View
ReactModalHostView is a view that sits in the view hierarchy representing a Modal view.
It does a number of things:
It creates a Dialog. We use this Dialog to actually display the Modal in the window.
It creates a DialogRootViewGroup. This view is the view that is displayed by the Dialog. To display a view within a Dialog, that view must have its parent set to the window the Dialog creates. Because of this, we can not use the ReactModalHostView since it sits in the normal React view hierarchy. We do however want all of the layout magic to happen as if the DialogRootViewGroup were part of the hierarchy. Therefore, we forward all view changes around addition and removal of views to the DialogRootViewGroup.
Types
DialogRootViewGroup is the ViewGroup which contains all the children of a Modal. It gets all child information forwarded from ReactModalHostView and uses that to create children. It is also responsible for acting as a RootView and handling touch events. It does this the same way as ReactRootView.
Properties
Functions
Called when host activity receives destroy event (e.g. Activity.onDestroy. Only called for the last React activity to be destroyed.
Called when host activity receives pause event (e.g. Activity.onPause. Always called for the most current activity.
Called either when the host activity receives a resume event (e.g. Activity.onResume or if the native module that implements this is initialized while the host activity is already resumed. Always called for the most current activity.
Sets the testID on the DialogRootViewGroup. Since the accessibility events are not triggered on the on the ReactModalHostView, the testID is forwarded to the DialogRootViewGroup to set the resource-id.
showOrUpdate will display the Dialog. It is called by the manager once all properties are set because we need to know all of them before creating the Dialog. It is also smart during updates if the changed properties can be applied directly to the Dialog or require the recreation of a new Dialog.