/** * @param: * title: 标题 * summary: 标题下的灰字简介 * background: 背景色 * tubeColor: 左边小长条背景色 * ifTubeShow: 左侧icon是否显示,默认不显示 boolean */ import React, { Component } from "react"; import { StyleSheet, Text, View, } from "react-native"; import Dimensions from '../utils/dimensions' const styles = StyleSheet.create({ wrapper: { width: Dimensions.width, height: 45, paddingLeft: 14, justifyContent: "center", flexDirection: 'column', backgroundColor: 'yellow' }, line1: { flex: 1, alignItems: "center", flexDirection: 'row' }, line2: { // 123 flex: 1 }, tube: { width: 4, height: 14, marginRight: 6, backgroundColor: 'red' }, title: { color: '#373737', fontSize: 18 }, summary: { color: '#787878', fontSize: 16 } }) export default class TopicTitle extends Component { constructor(props) { super(props); } render() { let line2 = ; if (this.props.summary) { line2 = {this.props.summary} } let tube = ; if (this.props.ifTubeShow) { tube = 1 } const tubeColor = this.props.tubeColor ? this.props.tubeColor : '#ffd101'; return ( {this.props.title} {line2} ); } }