Steps to customize theme for Card attributes:
| Property | Description |
|---|---|
| cardDefaultBg | Background color for card item |
| listBorderColor | Card and CardItem border color |
| listItemPadding | Padding between card items |
With this theme of Card component you can modify any style rules applied to the default Card component.
Syntax
import React, { Component } from 'react-native';
import { Container, Content, Card, CardItem, Text, Body, StyleProvider } from 'native-base';
import CardTheme from './Themes/CardTheme';
// CardTheme is the customized theme of Badge Component
export default class ThemeCardExample extends Component {
render() {
return (
<Container>
<Content>
<StyleProvider style={CardTheme()}>
<Card>
<CardItem>
<Body>
<Text>
NativeBase is a free and open source framework that enables
developers to build high-quality mobile apps using React Native
iOS and Android apps with a fusion of ES6.
</Text>
</Body>
</CardItem>
</Card>
</StyleProvider>
</Content>
</Container>
);
}
}With the variable.js file you can modify the variable values passed to the theme of the Card component.
Say backgroundColor of cardDefaultBg of the Card.
Syntax
import React, { Component } from 'react-native';
import { Container, Content, Card, CardItem, Text, StyleProvider, getTheme } from 'native-base';
import customVariables from './Themes/variable';
// getTheme is default theme of NativeBase Components
// customVariables is customized variables used in the components theme
export default class ThemeCardExample extends Component {
render() {
return (
<Container>
<Content>
<StyleProvider style={getTheme(customVariables)}>
<Card>
<CardItem>
<Body>
<Text>
NativeBase is a free and open source framework that enables
developers to build high-quality mobile apps using React Native
iOS and Android apps with a fusion of ES6.
</Text>
</Body>
</CardItem>
</Card>
</StyleProvider>
</Content>
</Container>
);
}
}