import * as React from 'react'; import type { Animated } from 'react-native'; export const AnimatedHeaderHeightContext: React.Context< Animated.AnimatedInterpolation | undefined > = React.createContext | undefined>( undefined ); export function useAnimatedHeaderHeight(): Animated.AnimatedInterpolation { const animatedValue = React.useContext(AnimatedHeaderHeightContext); if (animatedValue === undefined) { throw new Error( "Couldn't find the header height. Are you inside a screen in a native stack navigator?" ); } return animatedValue; }