More height hacks for iPhone

This commit is contained in:
Sam 2017-09-28 18:05:42 +10:00
parent 30fa5379ce
commit cfed431ef2
1 changed files with 30 additions and 15 deletions

View File

@ -17,25 +17,40 @@ function calcHeight() {
let withoutKeyboard = window.innerHeight - 270;
const min = 270;
// iPhone 6/7/8
if (window.innerHeight === 553) {
withoutKeyboard = 308;
// portrait
if (window.screen.height > window.screen.width) {
// iPhone SE
if (window.screen.height === 568) {
withoutKeyboard = 270;
}
// iPhone 6/7/8
if (window.screen.height === 667) {
withoutKeyboard = 295;
}
// iPhone 6/7/8 plus
if (window.innerHeight === 736) {
withoutKeyboard = 360;
}
// iPad can use innerHeight cause it renders nothing in the footer
if (window.innerHeight > 920) {
withoutKeyboard -= 45;
}
} else {
// landscape
//
// iPad, we have a bigger keyboard
if (window.innerWidth > window.innerHeight && window.innerHeight > 665) {
withoutKeyboard -= 128;
}
}
// iPhone 6/7/8 plus
if (window.innerHeight === 622) {
withoutKeyboard = 360;
}
// iPad landscape, so we have a bigger keyboard
if (window.innerWidth > window.innerHeight && window.innerHeight > 665) {
withoutKeyboard -= 128;
}
// iPad portrait also has a bigger keyboard
if (window.innerWidth < window.innerHeight && window.innerHeight > 920) {
withoutKeyboard -= 45;
}
return Math.max(withoutKeyboard, min);
}