mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {useWindowDimensions} from 'react-native'
2
3import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
4
5export function useHeaderOffset() {
6 const {isDesktop, isTablet} = useWebMediaQueries()
7 const {fontScale} = useWindowDimensions()
8 if (isDesktop || isTablet) {
9 return 0
10 }
11 const navBarHeight = 52
12 const tabBarPad = 10 + 10 + 3 // padding + border
13 const normalLineHeight = 20 // matches tab bar
14 const tabBarText = normalLineHeight * fontScale
15 return navBarHeight + tabBarPad + tabBarText - 4 // for some reason, this calculation is wrong by 4 pixels, which we adjust
16}