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

176
Views
React Native FlatList ignoring item spacing

I'm really struggling to figure out why i can't get my FlatList to render items the way that I would expect.

I'm using react-query in order to fetch a data array. I pass this array into my FlatList to be rendered, then I use a render function to render a list item. However my flat list completely ignores all of the item's padding and margin, sometimes.

Here's a snippet to better explain what I'm trying to do:

function Component() {
  data = [
    {a: true, otherStuff},
    {b: true, otherStuff}
  ]
  
  function renderItem({item, index}) {
    if (item.a) {
      return <ListItemA/>
    }
     if (item.b) {
       return <ListItemB/>
  }

render(
  <FlatList
    renderitem={renderItem}
    data={data}
  />
  )
}

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

0

if you will upload the components code, it will be more clear. try to use item separator and add spacing there https://reactnative.dev/docs/flatlist#itemseparatorcomponent a

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!