Reactnative Learning-listview

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.