mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
fix(android): nested dialog/fragment handling
This commit is contained in:
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user