React Native FlatList Component
FlatList is a React Native component that is a scrolling list that shows changing information while keeping the same look. It's great for long lists where the number of items can change. Instead of loading all items simultaneously, this component only shows what you can see on the screen. This makes it faster and gives users a better experience.
Syntax of FlatList:
<FlatList
data={}
renderItem={}
keyExtractor={}
/>
FlatList Props:
Props | Type | Description |
---|---|---|
renderItem | function | Extracts an item from the data and displays it in the list. |
data | ArrayLike | A list of items to render |
ItemSeparatorComponent | component, function, element | Used to render in between each item, but not at the top or bottom. |
ListEmptyComponent | component, element | Used to render when the list is empty. For example, displaying "No Data Found" when the list is empty. |
ListHeaderComponent | component, element | Used to render at the bottom of all the items. For example, "End of List" |
ListFooterComponent | component, element | Used to render at the bottom of all the items. For example, "Heading of the List" |
ListHeaderComponentStyle | ViewStyle | Used to Style ListHeaderComponent |
ListFooterComponentStyle | ViewStyle | Used to Style ListFooterComponent |
columnWrapperStyle | ViewStyle | Used to customize the style for multi-item rows when numColumns > 1. |
extraData | any | Used to re-render the list when the state changes. |
getItemLayout | function | Used to optimize performance by providing item layout. |
horizontal | boolean | Set to true for horizontal scrolling |
initialNumToRender | number (default: 10) | Number of items to render initially |
initialScrollIndex | number | Set the initial scroll index |
inverted | boolean | Set to true for inverted scrolling |
keyExtractor | function | Function to generate unique keys for items. |
numColumns | number | Set the number of columns |
onRefresh | function | Used to call for pull-to-refresh; requires refreshing prop. |
refreshing | boolean | Set to true during refresh loading. |
removeClippedSubviews | boolean | Used to improve performance by removing invisible views (Android only). |
onViewableItemsChanged | function | Used to call back when viewable items change. |
viewabilityConfig | object | Used to configure for determining item viewability (e.g., visibility%, waitForInteraction). |
viewabilityConfigCallbackPairs | array | It is an Array of ViewabilityConfig + callback pairs for tracking multiple configs. |
FlatList Methods:
Method | Description |
---|---|
flashScrollIndicators() | Used to display the scroll indicators momentarily |
getNativeScrollRef() | It provides a reference to the underlying scroll component |
getScrollResponder() | It provides a handle to the underlying scroll responder |
getScrollableNode() | It provides a handle to the underlying scroll node |
scrollToEnd() | Scrolls to the end of the content |
scrollToIndex() | Scrolls to the particular item index of the list |
Step-by-Step Implementation
Step 1: Create a React Native Project
Now, create a project with the following command.
npx create-expo-app app-name --template
Note: Replace the app-name with your app name for example : react-native-demo-app
Next, you might be asked to choose a template. Select one based on your preference as shown in the image below. I am selecting the blank template because it will generate a minimal app, as clean as an empty canvas in JavaScript.

It completes the project creation and displays a message: "Your Project is ready!" as shown in the image below.

Now go into your project folder, i.e., react-native-demo
cd app-name
Project Structure:

Step 2: Run Application
Start the server by using the following command.
npx expo start
Then, the application will display a QR code.
- For the Android users,
- For the Android Emulator, press "a" as mentioned in the image below.
- For Physical Device, Download the "Expo Go" app from the Play Store. Open the app, and you will see a button labeled "Scan QR Code." Click that button and scan the QR code; it will automatically build the Android app on your device.
- For iOS users, simply scan the QR code using the Camera app.
- If you're using a web browser, it will provide a local host link that you can use as mentioned in the image below.

Step 3: Edit Code
App.js:
import React, { Component } from "react";
import { Text, View, StyleSheet, FlatList } from "react-native";
import { Icon } from "react-native-elements";
class App extends Component {
state = {
data: [
"Data Structures",
"STL",
"C++",
"Java",
"Python",
"ReactJS",
"Angular",
"NodeJs",
"PHP",
"MongoDb",
"MySql",
"Android",
"iOS",
"Hadoop",
"Ajax",
"Ruby",
"Rails",
".Net",
"Perl",
],
};
renderItem = ({ item }) => (
<View style={styles.row}>
<Text style={styles.rowText}>{item}</Text>
<Icon name="eye" type="ionicon" color="#C2185B" />
</View>
);
keyExtractor = (item, index) => index.toString();
render() {
return (
<View style={styles.screen}>
<FlatList
data={this.state.data}
renderItem={this.renderItem}
keyExtractor={this.keyExtractor}
/>
</View>
);
}
}
const styles = StyleSheet.create({
screen: {
marginTop: 30,
},
row: {
margin: 15,
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingHorizontal: 2,
},
rowText: {
fontSize: 18,
},
});
export default App;
Output:
- Image:

- Video: