ListView is now deprecated and you should use FlatList . FlatList has support called numColumns , which is exactly what we want to create a scrollable grid.
For example:
const data = [ {id: 'a', value: 'A'}, {id: 'b', value: 'B'}, {id: 'c', value: 'C'}, {id: 'd', value: 'D'}, {id: 'e', value: 'E'}, {id: 'f', value: 'F'}, ]; const numColumns = 3; const size = Dimensions.get('window').width/numColumns; const styles = StyleSheet.create({ itemContainer: { width: size, height: size, }, item: { flex: 1, margin: 3, backgroundColor: 'lightblue', } }); function Grid(props) { return ( <FlatList data={data} renderItem={({item}) => ( <View style={styles.itemContainer}> <Text style={styles.item}>{item.value}</Text> </View> )} keyExtractor={item => item.id} numColumns={numColumns} /> ); }

This blog post describes the new features of FlatList well.
Note. For some reason, you should use keyExtractor in a FlatList instead of the typical key support for each element. Otherwise, you will receive a warning. Sources FlatList Warning - React Native
Tim Perkins Sep 22 '17 at 15:49 2017-09-22 15:49
source share