/** * Created by zack on 2018/4/30. */ import { View, Text, StyleSheet, Image, TouchableOpacity, TextInput } from 'react-native' import React, {Component} from 'react' import {NavigationBarHeight, TabBarHeight, ScreenDimensions} from '../../../../utils/DimensionsTools' export default class MyAnswerTitleItem extends Component { constructor(props) { super(props) this.state = { title: props.title } } componentWillReceiveProps(props) { this.setState({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, backgroundColor: 'white' }, TitleText: { marginLeft: 21, marginTop: 17, fontSize: 15, color: '#9c9c9c' } })