Returns the current scroll position and viewport height from the nearest OptimizationScrollProvider.
The scroll context value, or null if not within a OptimizationScrollProvider
null
function MyComponent() { const scroll = useScrollContext() return <Text>Scroll Y: {scroll?.scrollY ?? 0}</Text>} Copy
function MyComponent() { const scroll = useScrollContext() return <Text>Scroll Y: {scroll?.scrollY ?? 0}</Text>}
Returns the current scroll position and viewport height from the nearest OptimizationScrollProvider.