React Native does not have a built-in CSS Grid system like the web. Instead, grid-like layouts are created using Flexbox, primarily with flexDirection, flexWrap, and calculated item widths.
flexDirection: "row"flexWrap: "wrap"FlatList supports grid layouts with numColumnsA basic grid layout is created by wrapping items inside a container with row direction and wrapping enabled. Each item is given a percentage width.
// Simple grid layout using Flexbox in React Native
import React from "react";
import { View, StyleSheet } from "react-native";
export default function App() {
return (
<View style={styles.container}>
<View style={styles.box} />
<View style={styles.box} />
<View style={styles.box} />
<View style={styles.box} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flexDirection: "row",
flexWrap: "wrap"
},
box: {
width: "50%",
height: 100,
backgroundColor: "#2563eb",
borderWidth: 1,
borderColor: "#ffffff"
}
});
Each box takes 50% width, creating two columns per row. When the row is full, items automatically move to the next line.
Use the buttons below to change the item width percentage and see how the layout reacts inside the mock phone screen.
FlatList with numColumns for large dataFlatList