Skip to content

Commit e9adab0

Browse files
committed
fix(platform): only set isPortrait when the width/height is set
1 parent c815074 commit e9adab0

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

src/platform/platform.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -569,24 +569,30 @@ export class Platform {
569569

570570
// we're keeping track of portrait and landscape dimensions
571571
// separately because the virtual keyboard can really mess
572-
// up accurate values when the keyboard up
573-
if (win.screen.width < win.screen.height) {
574-
this._isPortrait = true;
575-
if (this._pW < win['innerWidth']) {
576-
this._pW = win['innerWidth'];
577-
}
578-
if (this._pH < win['innerHeight']) {
579-
this._pH = win['innerHeight'];
580-
}
572+
// up accurate values when the keyboard is up
573+
if (win.screen.width > 0 && win.screen.height > 0) {
574+
if (win.screen.width < win.screen.height) {
581575

582-
} else {
583-
this._isPortrait = false;
584-
if (this._lW < win['innerWidth']) {
585-
this._lW = win['innerWidth'];
586-
}
587-
if (this._lH < win['innerHeight']) {
588-
this._lH = win['innerHeight'];
576+
if (this._pW < win['innerWidth']) {
577+
this._isPortrait = true;
578+
this._pW = win['innerWidth'];
579+
}
580+
if (this._pH < win['innerHeight']) {
581+
this._isPortrait = true;
582+
this._pH = win['innerHeight'];
583+
}
584+
585+
} else {
586+
if (this._lW < win['innerWidth']) {
587+
this._isPortrait = false;
588+
this._lW = win['innerWidth'];
589+
}
590+
if (this._lH < win['innerHeight']) {
591+
this._isPortrait = false;
592+
this._lH = win['innerHeight'];
593+
}
589594
}
595+
590596
}
591597
}
592598
}

0 commit comments

Comments
 (0)