Returns the current scroll position and viewport height from the nearest OptimizationScrollProvider.
The scroll context value, or null if not within an OptimizationScrollProvider
null
Useful for building custom scroll-position-dependent behaviors alongside Optimization tracking.
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.