Skip to content

Latest commit

 

History

History
executable file
·
166 lines (155 loc) · 5.49 KB

List.md

File metadata and controls

executable file
·
166 lines (155 loc) · 5.49 KB

list-def-headref

List

A base component for specifying lists of information. List must contain one or more list elements. Props provide configurability for several features. Provides a number of attributes that follow styling and interaction guidelines for each platform, so that they are intuitive for users to interact with.

Preview ios list-def-headref Preview android list-def-headref

Contents:

Syntax

import React, { Component } from 'react';
import { Container, Header, Content, List, ListItem, Text } from 'native-base';
export default class ListExample extends Component {
  render() {
    return (
      <Container>
        <Header />
        <Content>
          <List>
            <ListItem>
              <Text>Simon Mignolet</Text>
            </ListItem>
            <ListItem>
              <Text>Nathaniel Clyne</Text>
            </ListItem>
            <ListItem>
              <Text>Dejan Lovren</Text>
            </ListItem>
          </List>
        </Content>
      </Container>
    );
  }
}

  • List: This component defines a section to include your list items.
  • ListItem:
    • This is the child component of List.
    • Defines a list item.
    • Adds border at bottom of each ListItem.
    • List takes any number of ListItem.
    • Takes input such as: Text, Badge, Thumbnail, Icon.

Replacing Component

Configuration

Property Default Option Description
button - boolean To navigate on click of a list item.
dataArray Array user-defined array Array of data chunks to render iteratively.
selected true boolean Highlights the selected item
itemDivider - boolean Helps to organize and group the list items.
itemHeader - - Style the item as header for ListItems
first - - Adds style of first ListItem
last - - Adds style of last ListItem
icon - - To have list styling of icons
avatar - - Style the list to have Avatars
thumbnail - - Style the list to have Thumbnails
renderRow Function - Callback which takes a chunk of data from dataArray and return as a component
enableEmptySections - boolean Flag indicating whether empty section headers should be rendered

Note: List is deprecated. Use of List for dynamic list generation is discouraged. Use Flatlist instead.