Created
October 14, 2022 06:18
-
-
Save itispx/37e3cc2df0ffdb2835e774c1f51992d7 to your computer and use it in GitHub Desktop.
useHeaderHeight hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getDefaultHeaderHeight } from "@react-navigation/elements"; | |
import { | |
useSafeAreaFrame, | |
useSafeAreaInsets, | |
} from "react-native-safe-area-context"; | |
const useHeaderHeight = () => { | |
const frame = useSafeAreaFrame(); | |
const insets = useSafeAreaInsets(); | |
const height = getDefaultHeaderHeight(frame, false, insets.top); | |
return height; | |
}; | |
export default useHeaderHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getDefaultHeaderHeight } from "@react-navigation/elements"; | |
import { | |
useSafeAreaFrame, | |
useSafeAreaInsets, | |
} from "react-native-safe-area-context"; | |
const useHeaderHeight = (): number => { | |
const frame = useSafeAreaFrame(); | |
const insets = useSafeAreaInsets(); | |
const height = getDefaultHeaderHeight(frame, false, insets.top); | |
return height; | |
}; | |
export default useHeaderHeight; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment