Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda