Skip to content

Latest commit

 

History

History
executable file
·
58 lines (54 loc) · 1.81 KB

DynamicCard.md

File metadata and controls

executable file
·
58 lines (54 loc) · 1.81 KB

##dynamic-card-headref

Dynamic Card

A center aspect designed for efficient representation of vertically scrolling lists of changing data. This can be achieved with the concept of dataArray.
Create a Card dataArray, populate it with an easy array of data chunks, and instantiate a CardItem 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_Card Preview android Dynamic_Card

Syntax

import React, { Component } from "react";
import { Container, Header, Content, Card, CardItem, Icon, Text, Right } from "native-base";
const items = [
  {
    iconName: "logo-googleplus",
    text: "Google Plus"
  },
  {
    iconName: "logo-facebook",
    text: "Facebook"
  },
  {
    iconName: "logo-twitter",
    text: "Twitter"
  },
  {
    iconName: "logo-reddit",
    text: "Reddit"
  },
  {
    iconName: "logo-linkedin",
    text: "LinkedIn"
  },
];
export default class DynamicCardExample extends Component {
  render() {
    return (
      <Container>
        <Header />
        <Content>
          <Card
            dataArray={items}
            renderRow={item =>
              <CardItem button>
                <Icon active name={item.iconName} />
                <Text>{item.text}</Text>
                <Right>
                  <Icon name="arrow-forward" style={{ color: "#999" }} />
                </Right>
              </CardItem>
            }
          />
        </Content>
      </Container>
    );
  }
}