Bluesky app fork with some witchin' additions 💫

Ignore bogus onScroll values (#5499)

authored by samuel.fm and committed by

GitHub 4553e6b6 dd2fedb2

+10 -3
+10 -3
src/view/com/pager/PagerWithHeader.tsx
··· 161 161 (e: NativeScrollEvent) => { 162 162 'worklet' 163 163 const nextScrollY = e.contentOffset.y 164 - scrollY.value = nextScrollY 165 - runOnJS(queueThrottledOnScroll)() 164 + // HACK: onScroll is reporting some strange values on load (negative header height). 165 + // Highly improbable that you'd be overscrolled by over 400px - 166 + // in fact, I actually can't do it, so let's just ignore those. -sfn 167 + const isPossiblyInvalid = 168 + headerHeight > 0 && Math.round(nextScrollY * 2) / 2 === -headerHeight 169 + if (!isPossiblyInvalid) { 170 + scrollY.value = nextScrollY 171 + runOnJS(queueThrottledOnScroll)() 172 + } 166 173 }, 167 - [scrollY, queueThrottledOnScroll], 174 + [scrollY, queueThrottledOnScroll, headerHeight], 168 175 ) 169 176 170 177 const onPageSelectedInner = React.useCallback(