FlatList visible only if there is at least 2 items

Hi
When my data set 1 item, the list does not render and the screen is blank, just the word ALERTS appears

When I hard code in a few more items to the symbols list, it displays all of the items no problem.

Not sure if this is a problem with my code or the FlatList component, hoping someone here can help if possible. Cheers

The snack can be viewed here

So I took a look at your code, and your item is being rendered, just with no width so you can’t see it. By adding width: dimensions.fullWidth to your top level View on the MyListItem, it fixes this issue.

Thank you.

Can you tell me why it was able to render 2 items if there was no width? Why can it do 2 and not 1?

your separator item has a width on it. for one item, there is no separator item rendered, but for more than one, there is. So once a separator item was rendered, it would stretch the flatlist to the width of that separator item.

ahhh, makes sense. Thanks breadboxio

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.