mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix-next(frame): remove current entry fragment on reset root view (#5533)
* chore(e2e): add @types as devDependencies Update `tsconfig.json` file. * fix-next(frame): remove current entry fragment on reset root view * refactor(e2e): undo skip tab root tests * refactor(frame): extract disposeCurrentFragment() method Extract the common logic from _onRootViewReset() and onUnloaded() methods to avoid code duplication.
This commit is contained in:
@@ -176,16 +176,23 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
}
|
||||
|
||||
_onRootViewReset(): void {
|
||||
this.disposeCurrentFragment();
|
||||
super._onRootViewReset();
|
||||
}
|
||||
|
||||
onUnloaded() {
|
||||
this.disposeCurrentFragment();
|
||||
super.onUnloaded();
|
||||
}
|
||||
|
||||
private disposeCurrentFragment(){
|
||||
if (this._currentEntry && this._currentEntry.fragment) {
|
||||
const manager: android.app.FragmentManager = this._getFragmentManager();
|
||||
|
||||
const transaction = manager.beginTransaction();
|
||||
transaction.remove(this._currentEntry.fragment);
|
||||
transaction.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
super.onUnloaded();
|
||||
}
|
||||
|
||||
private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): android.app.Fragment {
|
||||
|
||||
Reference in New Issue
Block a user