Card is a pure NativeBase component.
Card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options.
NativeBase Cards support a wide variety of content, including images, text, list groups, links, and more. Mix and match multiple content types to create the card you need.
Contents:
- Card Header and Footer
- CardItem Bordered
- CardItem Button
- Card Transparent
- Card List
- Card Image
- Card Showcase
Genertal Syntax
import React, { Component } from 'react';
import { Container, Header, Content, Card, CardItem, Body, Text } from 'native-base';
export default class CardExample extends Component {
render() {
return (
<Container>
<Header />
<Content>
<Card>
<CardItem>
<Body>
<Text>
//Your text here
</Text>
</Body>
</CardItem>
</Card>
</Content>
</Container>
);
}
}- Card
- This component adds a box-shadow by default.
- Also provides default spacing and alignment between cards.
- CardItem
- This is the child component of
Card. - Works very similar to the list items of list.
- Takes input such as: Text, Button, Image, Thumbnail, Icon.
- Card takes any number of CardItem.
- This is the child component of
- Replacing Component
- React Native View for Card
- React Native TouchableOpacity / View for CardItem
Configuration for Card
| Property | Default | Option | Description |
|---|---|---|---|
| transparent | - | - | Removes card shadow from iOS and elevation from android |
| dataArray | Array | user-defined array | Array of data chunks to render iteratively. |
| renderRow | Function | - | Callback which takes a chunk of data from dataArray and returns as a component. |
Configuration for CardItem
| Property | Default | Option | Description |
|---|---|---|---|
| header | - | - | Displays text as header for cards |
| cardBody | - | - | Defines section for body of card. The child components are rendered with proper spacing and alignment. |
| footer | - | - | Displays text as footer for cards |
| button | - | - | To navigate on click of a card item. |
| bordered | false | boolean | Adds border to the cardItems |

