import React from 'react' import {SharedValue, useSharedValue} from 'react-native-reanimated' type StateContext = { headerHeight: SharedValue footerHeight: SharedValue } const stateContext = React.createContext({ headerHeight: { value: 0, addListener() {}, removeListener() {}, modify() {}, }, footerHeight: { value: 0, addListener() {}, removeListener() {}, modify() {}, }, }) export function Provider({children}: React.PropsWithChildren<{}>) { const headerHeight = useSharedValue(0) const footerHeight = useSharedValue(0) const value = React.useMemo( () => ({ headerHeight, footerHeight, }), [headerHeight, footerHeight], ) return {children} } export function useShellLayout() { return React.useContext(stateContext) }