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

190
Views
React Native, FlatList does not output my list correctly

I have this quite easy items where I normally loop over with map:

{items.map((item, index) => {
  return (
    <Item
      desc={item.desc}
      done={item.done}
      index={index}
      key={index}
      onSetDone={setDone}
    />
  );
})}

The above code works fine, but as I learned, it is better do use FlatList in my components do render something in a loop. So I tried the following:

<FlatList
  data={items}
  renderItem={(item, index) => (
    <Item
      desc={item.desc}
      done={item.done}
      index={index}
      onSetDone={setDone}
    />
  )}
  keyExtractor={(item, index) => index}
/>

The correct amount of items are rendered, but unfortunately, none of the props gets passed to the Child component. Getting undefined undefined true.

What am I doing wrong here? Why is my data not correctly passed?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are not giving renderItem a function with the right parameter. Here is its signature from the doc:

renderItem({ item, index, separators })

Change your code to this:

<FlatList
  data={items}
  renderItem={({ item, index }) => (
    <Item desc={item.desc} done={item.done} index={index} onSetDone={setDone} />
  )}
  keyExtractor={(item, index) => index}
/>
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!