UNPKG

react-native-ui-lib

Version:

UI Components Library for React Native ###### Lateset version support RN44

48 lines (40 loc) 896 B
import React, {PropTypes} from 'react'; import {View, StyleSheet} from 'react-native'; import {BaseComponent} from '../../commons'; /** * CardItem, a sub Card component for layout-ing inside a card */ export default class CardItem extends BaseComponent { static displayName = 'CardItem'; static propTypes = { /** * align flex as a row (default) */ row: PropTypes.bool, /** * align flex as a column */ column: PropTypes.bool, }; defaultProps = { row: true, } generateStyles() { this.styles = createStyles(this.props); } render() { const {style} = this.props; return ( <View style={[this.styles.container, style]}> {this.props.children} </View> ); } } function createStyles({column}) { return StyleSheet.create({ container: { flexDirection: column ? 'column' : 'row', }, }); }