Skip to content

Latest commit

 

History

History
executable file
·
34 lines (29 loc) · 1.54 KB

DynamicList.md

File metadata and controls

executable file
·
34 lines (29 loc) · 1.54 KB

dynamic-list-headref

Dynamic List

A center aspect designed for efficient representation of vertically scrolling lists of changing data. The simplest way is to create a List dataArray, populate it with an array of data chunks, and instantiate a ListItem component with that chunk of data and a renderRow callback which takes a chunk from the whole data array and returns a renderable component.

Preview ios dynamic-list-headref Preview android dynamic-list-headref

Syntax

import React, { Component } from 'react';
import { Container, Header, Content, List, ListItem, Text } from 'native-base';
export default class DynamicListExample extends Component {
  render() {
    var items = ['Simon Mignolet','Nathaniel Clyne','Dejan Lovren','Mama Sakho','Emre Can'];
    return (
      <Container>
        <Header />
        <Content>
          <List dataArray={items}
            renderRow={(item) =>
              <ListItem>
                <Text>{item}</Text>
              </ListItem>
            }>
          </List>
        </Content>
      </Container>
    );
  }
}

For more advanced implementation of rendering list dynamically, take a look at nativebase-tutorial.