Skip to content

Commit e43c754

Browse files
author
Vasil Chimev
authored
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.
1 parent cf8dcfa commit e43c754

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

e2e/modal-navigation/e2e/e2e-spec-tab-root/tab-root-modal-frame.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { modalFrameBackground,
66
testNestedModalPageBackground
77
} from "../shared.e2e-spec"
88

9-
describe.skip("tab root modal frame background scenarios", () => {
9+
describe("tab root modal frame background scenarios", () => {
1010

1111
let driver: AppiumDriver;
1212
let screen: Screen;

e2e/modal-navigation/e2e/e2e-spec-tab-root/tab-root-modal-page.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { modalPageBackground,
66
testNestedModalPageBackground
77
} from "../shared.e2e-spec"
88

9-
describe.skip("tab root modal page background scenarios", () => {
9+
describe("tab root modal page background scenarios", () => {
1010

1111
let driver: AppiumDriver;
1212
let screen: Screen;

e2e/modal-navigation/e2e/e2e-spec-tab-root/tab-root-modal-tab.e2e-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { modalFrameBackground,
88
testSecondItemBackground
99
} from "../shared.e2e-spec"
1010

11-
describe.skip("tab root modal tab view background scenarios", () => {
11+
describe("tab root modal tab view background scenarios", () => {
1212

1313
let driver: AppiumDriver;
1414
let screen: Screen;

e2e/modal-navigation/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"uglifyjs-webpack-plugin": "~1.1.6",
3636
"webpack": "~3.10.0",
3737
"webpack-bundle-analyzer": "^2.9.1",
38-
"webpack-sources": "~1.1.0"
38+
"webpack-sources": "~1.1.0",
39+
"@types/chai": "^4.0.2",
40+
"@types/mocha": "^2.2.41",
41+
"@types/node": "^7.0.5"
3942
},
4043
"scripts": {
4144
"e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts",

e2e/modal-navigation/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"exclude": [
2525
"node_modules",
2626
"platforms",
27-
"e2e"
27+
"e2e"
2828
]
29-
}
29+
}

tns-core-modules/ui/frame/frame.android.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,23 @@ export class Frame extends FrameBase {
176176
}
177177
}
178178

179+
_onRootViewReset(): void {
180+
this.disposeCurrentFragment();
181+
super._onRootViewReset();
182+
}
183+
179184
onUnloaded() {
185+
this.disposeCurrentFragment();
186+
super.onUnloaded();
187+
}
188+
189+
private disposeCurrentFragment(){
180190
if (this._currentEntry && this._currentEntry.fragment) {
181191
const manager: android.app.FragmentManager = this._getFragmentManager();
182-
183192
const transaction = manager.beginTransaction();
184193
transaction.remove(this._currentEntry.fragment);
185194
transaction.commitAllowingStateLoss();
186195
}
187-
188-
super.onUnloaded();
189196
}
190197

191198
private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): android.app.Fragment {

0 commit comments

Comments
 (0)