feat: first commit

This commit is contained in:
eleanor.mao
2025-03-31 22:34:22 +08:00
commit d25187c9c8
390 changed files with 57031 additions and 0 deletions

View File

@ -0,0 +1,36 @@
import Taro from '@tarojs/taro';
import { useRef } from 'react';
function useNavigation() {
const statusBarHeight = useRef(0);
const barHeight = useRef(0);
const systemInfo = Taro.getWindowInfo();
if (systemInfo.statusBarHeight) {
statusBarHeight.current = systemInfo.statusBarHeight;
}
// #ifndef MP
// if (process.env.TARO_ENV !== 'weapp') {
// barHeight.current = statusBarHeight.current + (systemInfo.platform === 'android' ? 50 : 40);
// }
// #endif
// #ifdef MP-WEIXIN
if (process.env.TARO_ENV === 'weapp') {
const custom = Taro.getMenuButtonBoundingClientRect();
barHeight.current = custom.bottom + custom.top - statusBarHeight.current;
}
// #endif
// #ifdef MP-ALIPAY
// barHeight.current = statusBarHeight.current + systemInfo.titleBarHeight!;
// #endif
return {
barHeight,
statusBarHeight,
};
}
export default useNavigation;