import React, { PureComponent } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import FSI18n from '@brandingbrand/fsi18n';
const styles = StyleSheet.create({
    row: {
        flexDirection: 'row',
        alignItems: 'center',
        paddingTop: 3,
        paddingBottom: 3
    },
    leftColumn: {
        flex: 1
    },
    rightColumn: {
        flex: 1,
        justifyContent: 'flex-end'
    },
    rightColumnText: {
        textAlign: 'right'
    }
});
export class Total extends PureComponent {
    renderData(data, style) {
        if (typeof data === 'string') {
            return (<Text style={style}>{data}</Text>);
        }
        if (isCurrency(data)) {
            return (<Text style={style}>{FSI18n.currency(data)}</Text>);
        }
        return data;
    }
    render() {
        return (<View style={[styles.row, this.props.style]}>
        <View style={styles.leftColumn}>
          {this.renderData(this.props.keyName, [this.props.keyStyle])}
        </View>
        <View style={styles.rightColumn}>
          {this.renderData(this.props.value, [styles.rightColumnText, this.props.valueStyle])}
        </View>
      </View>);
    }
}
function isCurrency(data) {
    return !!(data.value && data.currencyCode);
}
//# sourceMappingURL=Total.js.map