So I have this array, as shown below:
const categoryData=[
{
id: 1,
name: "cat1",
icon: icons.one
},
{
id: 2,
name: "cat2",
icon: icons.two
},
]
I'm trying to store it in a useState const called categories, and then display categories in the data parameter within a FlatList:
const [categories, setCategories] = React.useState(categoryData)
<FlatList
data={categories}
keyExtractor={item => `${item.id}`}
renderItem={renderItem}
numColumns={4}
contentContainerStyle={{ padding: SIZES.padding }}
/>
However, nothing renders when within the FlatList (important to note, the FlatList loads when a Modal is triggered, and the FlatList does render the items properly when data={categoryData} instead of just categories).
Thanks for the assistance.
EDIT: Here is an Expo link to depict the issue (https://snack.expo.dev/HsffYfsrc)