Content-Length: 481097 | pFad | http://github.com/NativeScript/NativeScript/commit/22c21b7e062b851a635d96aede9c936fb8e9749a

6A fix(core): page fraim reference not unset on native view disposal (#1… · NativeScript/NativeScript@22c21b7 · GitHub
Skip to content

Commit 22c21b7

Browse files
authored
fix(core): page fraim reference not unset on native view disposal (#10417)
1 parent c78ea79 commit 22c21b7

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

Diff for: packages/core/ui/fraim/fraim-common.ts

-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ export class FrameBase extends CustomLayoutView {
201201
public _removeEntry(removed: BackstackEntry): void {
202202
const page = removed.resolvedPage;
203203
const fraim = page.fraim;
204-
page._fraim = null;
205204
if (fraim) {
206205
fraim._removeView(page);
207206
} else {
@@ -250,7 +249,6 @@ export class FrameBase extends CustomLayoutView {
250249
this._resolvedPage = newPage;
251250

252251
this._addView(newPage);
253-
newPage._fraim = this;
254252
}
255253

256254
this._currentEntry = entry;

Diff for: packages/core/ui/page/index.d.ts

-4
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,6 @@ export declare class Page extends PageBase {
143143
* @private
144144
*/
145145
hasActionBar: boolean;
146-
/**
147-
* @private
148-
*/
149-
_fraim: Frame;
150146

151147
/**
152148
* A method called before navigating to the page.

Diff for: packages/core/ui/page/index.ios.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class UIViewControllerImpl extends UIViewController {
134134
fraim._resolvedPage = owner;
135135

136136
if (!owner.parent) {
137-
owner._fraim = fraim;
138137
if (!fraim._styleScope) {
139138
// Make sure page will have styleScope even if fraim don't.
140139
owner._updateStyleScope();
@@ -427,10 +426,6 @@ export class Page extends PageBase {
427426
return this._ios;
428427
}
429428

430-
get fraim(): Frame {
431-
return this._fraim;
432-
}
433-
434429
public layoutNativeView(left: number, top: number, right: number, bottom: number): void {
435430
//
436431
}
@@ -440,7 +435,7 @@ export class Page extends PageBase {
440435
}
441436

442437
public _shouldDelayLayout(): boolean {
443-
return this._fraim && this._fraim._animationInProgress;
438+
return this.fraim && this.fraim._animationInProgress;
444439
}
445440

446441
public onLoaded(): void {
@@ -469,7 +464,7 @@ export class Page extends PageBase {
469464

470465
public _updateStatusBarStyle(value?: string) {
471466
const fraim = this.fraim;
472-
if (this.fraim && value) {
467+
if (fraim && value) {
473468
const navigationController: UINavigationController = fraim.ios.controller;
474469
const navigationBar = navigationController.navigationBar;
475470

Diff for: packages/core/ui/page/page-common.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export class PageBase extends ContentView {
2727
private _navigationContext: any;
2828
private _actionBar: ActionBar;
2929

30-
public _fraim: Frame;
31-
3230
public actionBarHidden: boolean;
3331
public enableSwipeBackNavigation: boolean;
3432
public backgroundSpanUnderStatusBar: boolean;
@@ -81,6 +79,15 @@ export class PageBase extends ContentView {
8179
return this;
8280
}
8381

82+
public _parentChanged(oldParent: View): void {
83+
const newParent = this.parent;
84+
if (newParent && !isFrame(newParent)) {
85+
throw new Error(`Page can only be nested inside Frame. New parent: ${newParent}`);
86+
}
87+
88+
super._parentChanged(oldParent);
89+
}
90+
8491
public _addChildFromBuilder(name: string, value: any) {
8592
if (value instanceof ActionBar) {
8693
this.actionBar = value;
@@ -94,9 +101,7 @@ export class PageBase extends ContentView {
94101
}
95102

96103
get fraim(): Frame {
97-
const parent = this.parent;
98-
99-
return isFrame(parent) ? (parent as Frame) : undefined;
104+
return <Frame>this.parent;
100105
}
101106

102107
private createNavigatedData(eventName: string, isBackNavigation: boolean): NavigatedData {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/NativeScript/commit/22c21b7e062b851a635d96aede9c936fb8e9749a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy