n8tb1t/use-scroll-position

Scroll bounce on iphone

kuyucakli opened this issue · 1 comments

Hi, I have tried to use your hook, it is elegant but on mobile (iphone) it does not account for scroll bounce behaviour and navbar stays hidden after the bounce.

I have tried to limit the state update -->

useScrollPosition(
    ({ prevPos, currPos }) => {
      if(currPos.y >= 40){   // for scroll bounce problem (not working always)
      let isShow = currPos.y > prevPos.y
      
      if (isShow !== hideOnScroll  ) setHideOnScroll(isShow)
      }
    },
    [hideOnScroll],
    null,
    true,
    300
  )

What browser do you use?