forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {useWindowDimensions} from 'react-native'
2import {useSafeAreaInsets} from 'react-native-safe-area-context'
3
4import {useBreakpoints} from '#/alf'
5import {IS_LIQUID_GLASS} from '#/env'
6
7export function useHeaderOffset() {
8 const {gtMobile} = useBreakpoints()
9 const {fontScale} = useWindowDimensions()
10 const insets = useSafeAreaInsets()
11 if (gtMobile) {
12 return 0
13 }
14 const navBarHeight = 52 + (IS_LIQUID_GLASS ? insets.top : 0)
15 const tabBarPad = 10 + 10 + 3 // padding + border
16 const normalLineHeight = 20 // matches tab bar
17 const tabBarText = normalLineHeight * fontScale
18 return navBarHeight + tabBarPad + tabBarText - 4 // for some reason, this calculation is wrong by 4 pixels, which we adjust
19}