Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Update React native ScriollView current scroll position to state with better performance

The image attached is a single screen, with different scroll positions. At frame A, thats the default, when the scroll position contentOffset.y is at 0, The second frame shows when the contentOffset.y === >200. I want to save the scroll position to my React state, and animate the view base on the scroll position.

I am using this function to get the scroll position and save it into the component state.

const handleOnScroll = (event: any) => {
    const { contentOffset } = event.nativeEvent
    const { y } = contentOffset
    if (y > 200) {
        setShowScreenTitle(true)
        setScrollPosition(y)
    } else {
        setShowScreenTitle(false)
        setScrollPosition(y)`
    }
}

The problem facing now is a performance problem as anytime the scrollPosition changes, The app refreshes, making the app looks like there's a glitch. How can I smoothly, update the states with the scroll position smoothly with better performance.

screen

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!