DEV Community


React Native Simple ListView Component Android Example

skptricks profile image skptricks ・1 min read

Post Link : React Native Simple ListView Component Android Example

Today we will see how to use ListView in react native android application and apply set onPress event on ListView to get value from selected list item. ListView is a core component designed for efficient display of vertically scrolling lists of changing data. The minimal API is to create a ListView.DataSource, populate it with a simple array of data blobs, and instantiate a ListView component with that data source and a renderRow callback which takes a blob from the data array and returns a renderable component.

In this example we are going to create simple ListView layout, where we will display hard coded values from state and when user click on any of these list items, then it will display selected item in alert dialog box.

Download Source Code

Discussion (1)

Editor guide
joe profile image
Joe Fazzino

Just so everyone knows ListViews are deprecated in favour of FlatList and SectionList which improve performance and do some clever virtualization.