fix(android): nested dialog/fragment handling

This commit is contained in:
Nathan Walker
2021-08-15 11:31:50 -07:00
parent 66203d24ee
commit 6822115cff

View File

@ -356,6 +356,9 @@ export class View extends ViewCommon {
} }
public _getFragmentManager(): androidx.fragment.app.FragmentManager { public _getFragmentManager(): androidx.fragment.app.FragmentManager {
if ((<any>global)._dialogFragment) {
return (<any>global)._dialogFragment.getChildFragmentManager();
}
let manager = this._manager; let manager = this._manager;
if (!manager) { if (!manager) {
let view: View = this; let view: View = this;
@ -708,18 +711,20 @@ export class View extends ViewCommon {
saveModal(dialogOptions); saveModal(dialogOptions);
this._dialogFragment = df; this._dialogFragment = df;
(<any>global)._dialogFragment = df;
this._raiseShowingModallyEvent(); this._raiseShowingModallyEvent();
this._dialogFragment.show(parent._getRootFragmentManager(), this._domId.toString()); this._dialogFragment.show(parent._getRootFragmentManager(), this._domId.toString());
} }
protected _hideNativeModalView(parent: View, whenClosedCallback: () => void) { protected _hideNativeModalView(parent: View, whenClosedCallback: () => void) {
const manager = this._dialogFragment.getFragmentManager(); const manager = this._dialogFragment.getParentFragmentManager();
if (manager) { if (manager) {
this._dialogFragment.dismissAllowingStateLoss(); this._dialogFragment.dismissAllowingStateLoss();
} }
this._dialogFragment = null; this._dialogFragment = null;
(<any>global)._dialogFragment = null;
whenClosedCallback(); whenClosedCallback();
} }