The advantage of the ListView with respect to the view is that it can not load the data all at once, but instead slides the data loaded, which can alleviate the data loading and avoid the software to die.
Official Document: Https://facebook.github.io/react-native/docs/listview.html#content
Simple to use:
Constructor (props) { super (props); var ds = new Listview.datasource ({rowhaschanged: (r1, r2) = R1!== R2}); This.state = { dataSource:ds.cloneWithRows ([' Row 1 ', ' Row 2 '] };} <listview contentcontainerstyle={{flexdirection: ' Row ', Flexwrap: ' Wrap ', justifycontent: ' Center '} Datasource={this.state.datasource} initiallistsize={14} renderrow={(RowData) =><text>{rowdata} </Text>}/> |
Contentcontainerstyle: Sets the style of the list datasource: Data source initiallistsize: The official document is interpreted to specify how many rows of data are rendered when the component is just mounted, but when actually used, The test is not the same thing at all ... (React version 0.23.0) renderrow:function (); (RowData, SectionID, RowID, highlightrow) = renderable
Accept a piece of data from the data source (DataSource), and the ID of the section where the data and data are located. Returns a component that can be rendered to render this row of data.
By default, the data in the parameter is put into the data source itself, but you can also provide some converters.
The ListView also has some other settings that can be viewed in detail in the official documentation.
Reactnative Learning-listview