20 lines
679 B
JavaScript
20 lines
679 B
JavaScript
function navigationGeometry(info = {}, menu = {}) {
|
|
const width = info.windowWidth || 375;
|
|
const height = info.windowHeight || 812;
|
|
const status = info.statusBarHeight || 24;
|
|
const validMenu = menu.top >= status && menu.height > 0 && menu.left > 0 && menu.left < width;
|
|
const top = validMenu ? menu.top : status + 6;
|
|
const rowHeight = validMenu ? menu.height : 32;
|
|
const menuLeft = validMenu ? menu.left : width - 100;
|
|
const headerHeight = top + rowHeight + 12;
|
|
return {
|
|
top,
|
|
rowHeight,
|
|
titleWidth: Math.max(80, menuLeft - 28),
|
|
headerHeight,
|
|
scrollHeight: Math.max(0, height - headerHeight),
|
|
};
|
|
}
|
|
|
|
module.exports = { navigationGeometry };
|