mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 01:43:14 +08:00
fix(core): page frame reference not unset on native view disposal (#10417)
This commit is contained in:

committed by
GitHub

parent
c78ea79f0f
commit
22c21b7e06
@ -201,7 +201,6 @@ export class FrameBase extends CustomLayoutView {
|
||||
public _removeEntry(removed: BackstackEntry): void {
|
||||
const page = removed.resolvedPage;
|
||||
const frame = page.frame;
|
||||
page._frame = null;
|
||||
if (frame) {
|
||||
frame._removeView(page);
|
||||
} else {
|
||||
@ -250,7 +249,6 @@ export class FrameBase extends CustomLayoutView {
|
||||
this._resolvedPage = newPage;
|
||||
|
||||
this._addView(newPage);
|
||||
newPage._frame = this;
|
||||
}
|
||||
|
||||
this._currentEntry = entry;
|
||||
|
4
packages/core/ui/page/index.d.ts
vendored
4
packages/core/ui/page/index.d.ts
vendored
@ -143,10 +143,6 @@ export declare class Page extends PageBase {
|
||||
* @private
|
||||
*/
|
||||
hasActionBar: boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_frame: Frame;
|
||||
|
||||
/**
|
||||
* A method called before navigating to the page.
|
||||
|
@ -134,7 +134,6 @@ class UIViewControllerImpl extends UIViewController {
|
||||
frame._resolvedPage = owner;
|
||||
|
||||
if (!owner.parent) {
|
||||
owner._frame = frame;
|
||||
if (!frame._styleScope) {
|
||||
// Make sure page will have styleScope even if frame don't.
|
||||
owner._updateStyleScope();
|
||||
@ -427,10 +426,6 @@ export class Page extends PageBase {
|
||||
return this._ios;
|
||||
}
|
||||
|
||||
get frame(): Frame {
|
||||
return this._frame;
|
||||
}
|
||||
|
||||
public layoutNativeView(left: number, top: number, right: number, bottom: number): void {
|
||||
//
|
||||
}
|
||||
@ -440,7 +435,7 @@ export class Page extends PageBase {
|
||||
}
|
||||
|
||||
public _shouldDelayLayout(): boolean {
|
||||
return this._frame && this._frame._animationInProgress;
|
||||
return this.frame && this.frame._animationInProgress;
|
||||
}
|
||||
|
||||
public onLoaded(): void {
|
||||
@ -469,7 +464,7 @@ export class Page extends PageBase {
|
||||
|
||||
public _updateStatusBarStyle(value?: string) {
|
||||
const frame = this.frame;
|
||||
if (this.frame && value) {
|
||||
if (frame && value) {
|
||||
const navigationController: UINavigationController = frame.ios.controller;
|
||||
const navigationBar = navigationController.navigationBar;
|
||||
|
||||
|
@ -27,8 +27,6 @@ export class PageBase extends ContentView {
|
||||
private _navigationContext: any;
|
||||
private _actionBar: ActionBar;
|
||||
|
||||
public _frame: Frame;
|
||||
|
||||
public actionBarHidden: boolean;
|
||||
public enableSwipeBackNavigation: boolean;
|
||||
public backgroundSpanUnderStatusBar: boolean;
|
||||
@ -81,6 +79,15 @@ export class PageBase extends ContentView {
|
||||
return this;
|
||||
}
|
||||
|
||||
public _parentChanged(oldParent: View): void {
|
||||
const newParent = this.parent;
|
||||
if (newParent && !isFrame(newParent)) {
|
||||
throw new Error(`Page can only be nested inside Frame. New parent: ${newParent}`);
|
||||
}
|
||||
|
||||
super._parentChanged(oldParent);
|
||||
}
|
||||
|
||||
public _addChildFromBuilder(name: string, value: any) {
|
||||
if (value instanceof ActionBar) {
|
||||
this.actionBar = value;
|
||||
@ -94,9 +101,7 @@ export class PageBase extends ContentView {
|
||||
}
|
||||
|
||||
get frame(): Frame {
|
||||
const parent = this.parent;
|
||||
|
||||
return isFrame(parent) ? (parent as Frame) : undefined;
|
||||
return <Frame>this.parent;
|
||||
}
|
||||
|
||||
private createNavigatedData(eventName: string, isBackNavigation: boolean): NavigatedData {
|
||||
|
Reference in New Issue
Block a user