import { createContext, RefObject, useContext } from 'react'; import { View } from 'react-native'; export type ScrollToNodeCallback = (ref: RefObject, additionalOffset?: number) => void; export const SpatialNavigatorParentScrollContext = createContext(() => {}); export const useSpatialNavigatorParentScroll = (): { scrollToNodeIfNeeded: ScrollToNodeCallback; } => { const scrollToNodeIfNeeded = useContext(SpatialNavigatorParentScrollContext); return { scrollToNodeIfNeeded }; };