/** * Created by zack on 2018/6/24. */ 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 UserCenterItem extends Component { constructor(props) { super(props) this.state = { image: props.image, title: props.title } } componentWillReceiveProps(props) { this.setState({ image: props.image, title: props.title }) } shouldComponentUpdate(nextProps) { if (nextProps.title !== this.state.title) { return true } return false } render() { return ( {this.state.title} ); } } const styles = StyleSheet.create({ View: { width: ScreenDimensions.width, height: 50, backgroundColor: 'white', flexDirection: 'row', alignItems: 'center' }, ImageView: { marginLeft: 30, marginRight: 17, marginTop: 5, }, Text: { fontSize: 13, color: '#666666' } })