mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix: Android platform.screen.mainScreen props are not invalidated after orientation change
Resolves #3270
This commit is contained in:
@@ -122,6 +122,7 @@ function pageFromBuilder(moduleNamePath: string, moduleExports: any): Page {
|
||||
|
||||
// Possible XML file path.
|
||||
var fileName = resolveFileName(moduleNamePath, "xml");
|
||||
|
||||
if (fileName) {
|
||||
if (trace.enabled) {
|
||||
trace.write("Loading XML file: " + fileName, trace.categories.Navigation);
|
||||
@@ -136,6 +137,11 @@ function pageFromBuilder(moduleNamePath: string, moduleExports: any): Page {
|
||||
}
|
||||
}
|
||||
|
||||
// Attempts to implement https://github.com/NativeScript/NativeScript/issues/1311
|
||||
// if (page && fileName === `${moduleNamePath}.port.xml` || fileName === `${moduleNamePath}.land.xml`){
|
||||
// page["isBiOrientational"] = true;
|
||||
// }
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -210,6 +216,27 @@ export class Frame extends CustomLayoutView implements definition.Frame {
|
||||
}
|
||||
}
|
||||
|
||||
// Attempts to implement https://github.com/NativeScript/NativeScript/issues/1311
|
||||
// private _subscribedToOrientationChangedEvent = false;
|
||||
// private _onOrientationChanged(){
|
||||
// if (!this._currentEntry){
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let currentPage = this._currentEntry.resolvedPage;
|
||||
// let currentNavigationEntry = this._currentEntry.entry;
|
||||
// if (currentPage["isBiOrientational"] && currentNavigationEntry.moduleName) {
|
||||
// if (this.canGoBack()){
|
||||
// this.goBack();
|
||||
// }
|
||||
// else {
|
||||
// currentNavigationEntry.backstackVisible = false;
|
||||
// }
|
||||
// // Re-navigate to the same page so the other (.port or .land) xml is loaded.
|
||||
// this.navigate(currentNavigationEntry);
|
||||
// }
|
||||
// }
|
||||
|
||||
public navigate(param: any) {
|
||||
if (trace.enabled) {
|
||||
trace.write(`NAVIGATE`, trace.categories.Navigation);
|
||||
@@ -218,6 +245,16 @@ export class Frame extends CustomLayoutView implements definition.Frame {
|
||||
var entry = buildEntryFromArgs(param);
|
||||
var page = resolvePageFromEntry(entry);
|
||||
|
||||
// Attempts to implement https://github.com/NativeScript/NativeScript/issues/1311
|
||||
// if (page["isBiOrientational"] && entry.moduleName && !this._subscribedToOrientationChangedEvent){
|
||||
// this._subscribedToOrientationChangedEvent = true;
|
||||
// let app = require("application");
|
||||
// if (trace.enabled) {
|
||||
// trace.write(`${this} subscribed to orientationChangedEvent.`, trace.categories.Navigation);
|
||||
// }
|
||||
// app.on(app.orientationChangedEvent, (data) => this._onOrientationChanged());
|
||||
// }
|
||||
|
||||
this._pushInFrameStack();
|
||||
|
||||
var backstackEntry: definition.BackstackEntry = {
|
||||
|
||||
Reference in New Issue
Block a user