/** * Created by zack on 2018/6/23. */ /** * Created by zack on 2018/6/23. */ import { View, Text, StyleSheet, Image, ImageBackground, TouchableOpacity, FlatList } from 'react-native' import React, {Component} from 'react' import {NavigationBarHeight, ScreenDimensions} from '../../../utils/DimensionsTools' export default class MineTextItem extends Component { constructor(props) { super(props) this.state = { title: props.title, desc: props.desc } } componentWillReceiveProps(props) { this.setState({ title: props.title, desc: props.desc }) } shouldComponentUpdate(nextProps) { if (nextProps.title !== this.state.title || nextProps.desc !== this.state.desc) { return true } return false } render() { return( { this.props.didSelectedItem() }} style={styles.View}> {this.state.title} {this.state.desc} ) } } const styles = StyleSheet.create({ View: { width: ScreenDimensions.width, height: 80, backgroundColor: 'white', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', }, LeftText: { fontSize: 14, color: '#333333', marginLeft: 15, }, ContainerView: { marginRight: 15, flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }, DescText: { fontSize: 14, color: '#333333', marginRight: 12, width: ScreenDimensions.width - 180, textAlign: 'right' } })