Skip to main content

FlatList

A performant interface for rendering basic, flat lists, supporting the most handy features:

How to use

import React from 'react';
import {FlatList, Text, View} from '@gyri/native-ui-components';

const DATA = [
{
id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba',
title: 'First Item',
},
{
id: '3ac68afc-c605-48d3-a4f8-fbd91aa97f63',
title: 'Second Item',
},
{
id: '58694a0f-3da1-471f-bd96-145571e29d72',
title: 'Third Item',
},
];

const Item = ({title}) => (
<View>
<Text>{title}</Text>
</View>
);

const MyComponent = ({style, className}) => (
<FlatList
style={style}
className={className}
data={DATA}
renderItem={({item}) => <Item title={item.title} />}
keyExtractor={item => item.id}
/>
);

export default MyComponent;

Props

#NameData typeDefault valueValuesDescription
1styleobjectCustom style object
2classNamestring''It defined nativewind style classes.

For more details https://reactnative.dev/docs/flatlist