Merge branch 'master' of https://gitee.com/ballminiprogramwe/mini-programs
This commit is contained in:
13
src/utils/getNavbarHeight.ts
Normal file
13
src/utils/getNavbarHeight.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
export const getNavbarHeight = (): { statusBarHeight: number; navbarHeight: number; totalHeight: number; } => {
|
||||
const systemInfo = Taro.getSystemInfoSync();
|
||||
const statusBarHeight = systemInfo?.statusBarHeight || 0;
|
||||
const isIOS = systemInfo.platform === "ios";
|
||||
const navbarHeight = isIOS ? 44 : 48;
|
||||
return {
|
||||
statusBarHeight,
|
||||
navbarHeight,
|
||||
totalHeight: statusBarHeight + navbarHeight,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user