mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +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:
@ -6,7 +6,7 @@ import { modalFrameBackground,
|
|||||||
testNestedModalPageBackground
|
testNestedModalPageBackground
|
||||||
} from "../shared.e2e-spec"
|
} from "../shared.e2e-spec"
|
||||||
|
|
||||||
describe.skip("tab root modal frame background scenarios", () => {
|
describe("tab root modal frame background scenarios", () => {
|
||||||
|
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
@ -6,7 +6,7 @@ import { modalPageBackground,
|
|||||||
testNestedModalPageBackground
|
testNestedModalPageBackground
|
||||||
} from "../shared.e2e-spec"
|
} from "../shared.e2e-spec"
|
||||||
|
|
||||||
describe.skip("tab root modal page background scenarios", () => {
|
describe("tab root modal page background scenarios", () => {
|
||||||
|
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
@ -8,7 +8,7 @@ import { modalFrameBackground,
|
|||||||
testSecondItemBackground
|
testSecondItemBackground
|
||||||
} from "../shared.e2e-spec"
|
} from "../shared.e2e-spec"
|
||||||
|
|
||||||
describe.skip("tab root modal tab view background scenarios", () => {
|
describe("tab root modal tab view background scenarios", () => {
|
||||||
|
|
||||||
let driver: AppiumDriver;
|
let driver: AppiumDriver;
|
||||||
let screen: Screen;
|
let screen: Screen;
|
||||||
|
@ -35,7 +35,10 @@
|
|||||||
"uglifyjs-webpack-plugin": "~1.1.6",
|
"uglifyjs-webpack-plugin": "~1.1.6",
|
||||||
"webpack": "~3.10.0",
|
"webpack": "~3.10.0",
|
||||||
"webpack-bundle-analyzer": "^2.9.1",
|
"webpack-bundle-analyzer": "^2.9.1",
|
||||||
"webpack-sources": "~1.1.0"
|
"webpack-sources": "~1.1.0",
|
||||||
|
"@types/chai": "^4.0.2",
|
||||||
|
"@types/mocha": "^2.2.41",
|
||||||
|
"@types/node": "^7.0.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts",
|
"e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts",
|
||||||
|
@ -176,16 +176,23 @@ export class Frame extends FrameBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onRootViewReset(): void {
|
||||||
|
this.disposeCurrentFragment();
|
||||||
|
super._onRootViewReset();
|
||||||
|
}
|
||||||
|
|
||||||
onUnloaded() {
|
onUnloaded() {
|
||||||
|
this.disposeCurrentFragment();
|
||||||
|
super.onUnloaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private disposeCurrentFragment(){
|
||||||
if (this._currentEntry && this._currentEntry.fragment) {
|
if (this._currentEntry && this._currentEntry.fragment) {
|
||||||
const manager: android.app.FragmentManager = this._getFragmentManager();
|
const manager: android.app.FragmentManager = this._getFragmentManager();
|
||||||
|
|
||||||
const transaction = manager.beginTransaction();
|
const transaction = manager.beginTransaction();
|
||||||
transaction.remove(this._currentEntry.fragment);
|
transaction.remove(this._currentEntry.fragment);
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onUnloaded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): android.app.Fragment {
|
private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): android.app.Fragment {
|
||||||
|
Reference in New Issue
Block a user