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

501
Visualizações
React Native: How to prevent an onLayout function from being called on every re-render

My React Native component has a prop this.props.a that gets updated every 60s elsewhere in the app. Within this component, I have a <View> with an onLayout() function. This onLayout gets called every 60s when the props are updated. Is there a way to get it to be called only the first time the component is rendered, and not on subsequent re-renders?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes! <View onLayout={()=> onLayout()}/> This part ()=>will prevent the onLayout function form being called on render.

Hope this helps! /W

about 4 years ago · Juan Pablo Isaza Relatório
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