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

498
Views
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 answers
Answer question

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 Report
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!