mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Fixed Issue #1201: iOS: A page that is disappearing with animation after navigation to another page should not be measured and laid out.
This commit is contained in:
@ -206,7 +206,11 @@ export class Frame extends frameCommon.Frame {
|
||||
}
|
||||
|
||||
public measurePage(page: pages.Page): { measuredWidth: number; measuredHeight: number } {
|
||||
|
||||
if (page && (<any>page)._viewWillDisappear) {
|
||||
//https://github.com/NativeScript/NativeScript/issues/1201
|
||||
return { measuredWidth: undefined, measuredHeight: undefined };
|
||||
}
|
||||
|
||||
// If background does not span under statusbar - reduce available height.
|
||||
let heightSpec: number = this._heightMeasureSpec;
|
||||
if (page && !page.backgroundSpanUnderStatusBar && !this.parent) {
|
||||
@ -229,6 +233,11 @@ export class Frame extends frameCommon.Frame {
|
||||
}
|
||||
|
||||
public layoutPage(page: pages.Page): void {
|
||||
if (page && (<any>page)._viewWillDisappear) {
|
||||
//https://github.com/NativeScript/NativeScript/issues/1201
|
||||
return;
|
||||
}
|
||||
|
||||
// If background does not span under statusbar - reduce available height and adjust top offset.
|
||||
let statusBarHeight = (page && !page.backgroundSpanUnderStatusBar && !this.parent) ? uiUtils.ios.getStatusBarHeight() : 0;
|
||||
|
||||
|
@ -96,6 +96,9 @@ class UIViewControllerImpl extends UIViewController {
|
||||
trace.write(owner + " viewWillAppear", trace.categories.Navigation);
|
||||
owner._enableLoadedEvents = true;
|
||||
|
||||
//https://github.com/NativeScript/NativeScript/issues/1201
|
||||
owner._viewWillDisappear = false;
|
||||
|
||||
// In iOS we intentionally delay the raising of the 'loaded' event so both platforms behave identically.
|
||||
// The loaded event must be raised AFTER the page is part of the windows hierarchy and
|
||||
// frame.topmost().currentPage is set to the page instance.
|
||||
@ -108,6 +111,18 @@ class UIViewControllerImpl extends UIViewController {
|
||||
owner._enableLoadedEvents = false;
|
||||
}
|
||||
|
||||
public viewWillDisappear() {
|
||||
let owner = this._owner.get();
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
|
||||
trace.write(owner + " viewWillDisappear", trace.categories.Navigation);
|
||||
|
||||
//https://github.com/NativeScript/NativeScript/issues/1201
|
||||
owner._viewWillDisappear = true;
|
||||
}
|
||||
|
||||
public viewDidDisappear() {
|
||||
let owner = this._owner.get();
|
||||
if (!owner) {
|
||||
@ -128,9 +143,10 @@ class UIViewControllerImpl extends UIViewController {
|
||||
export class Page extends pageCommon.Page {
|
||||
private _ios: UIViewController;
|
||||
public _enableLoadedEvents: boolean;
|
||||
public _isModal: boolean = false;
|
||||
public _UIModalPresentationFormSheet: boolean = false;
|
||||
public _delayLoadedEvent;
|
||||
public _isModal: boolean;
|
||||
public _UIModalPresentationFormSheet: boolean;
|
||||
public _delayLoadedEvent: boolean;
|
||||
public _viewWillDisappear: boolean;
|
||||
|
||||
constructor(options?: definition.Options) {
|
||||
super(options);
|
||||
|
Reference in New Issue
Block a user