No Description

MyAnswerTitleItem.js 952B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Created by zack on 2018/4/30.
  3. */
  4. import {
  5. View,
  6. Text,
  7. StyleSheet,
  8. Image,
  9. TouchableOpacity,
  10. TextInput
  11. } from 'react-native'
  12. import React, {Component} from 'react'
  13. import {NavigationBarHeight, TabBarHeight, ScreenDimensions} from '../../../../utils/DimensionsTools'
  14. export default class MyAnswerTitleItem extends Component {
  15. constructor(props) {
  16. super(props)
  17. this.state = {
  18. title: props.title
  19. }
  20. }
  21. componentWillReceiveProps(props) {
  22. this.setState({title: props.title})
  23. }
  24. shouldComponentUpdate(nextProps) {
  25. if (nextProps.title !== this.state.title) {
  26. return true
  27. }
  28. return false
  29. }
  30. render() {
  31. return(
  32. <View style={styles.View}>
  33. <Text style={styles.TitleText}>{this.state.title}</Text>
  34. </View>
  35. )
  36. }
  37. }
  38. const styles = StyleSheet.create({
  39. View: {
  40. width: ScreenDimensions.width,
  41. backgroundColor: 'white'
  42. },
  43. TitleText: {
  44. marginLeft: 21,
  45. marginTop: 17,
  46. fontSize: 15,
  47. color: '#9c9c9c'
  48. }
  49. })