about summary refs log tree commit diff
path: root/src/components/hooks/useHeaderOffset.ts
blob: e2290c04fbc62658e14282220a1372ecf3e0bc92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import {useWindowDimensions} from 'react-native'

import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'

export function useHeaderOffset() {
  const {isDesktop, isTablet} = useWebMediaQueries()
  const {fontScale} = useWindowDimensions()
  if (isDesktop || isTablet) {
    return 0
  }
  const navBarHeight = 42
  const tabBarPad = 10 + 10 + 3 // padding + border
  const normalLineHeight = 1.2
  const tabBarText = 16 * normalLineHeight * fontScale
  return navBarHeight + tabBarPad + tabBarText
}