/** * Created by zack on 2018/5/22. */ import { View, Text, StyleSheet, FlatList, Platform, TouchableOpacity, Image } from 'react-native' import React, {Component} from 'react' import {NavigationBarHeight, TabBarHeight, ScreenDimensions} from '../../../../utils/DimensionsTools' import ImageLoader from 'react-native-smart-image-loader' export default class PicAndTextDetailHeaderItem extends Component { constructor(props) { super(props) this.state = { imageUrls: props.imageUrls, title: props.title, } } // componentWillReceiveProps(props) { // this.setState({ // imageUrls: props.imageUrls, // title: props.title, // }) // } // // shouldComponentUpdate(nextProps) { // if (nextProps.imageUrls !== this.state.imageUrls || // nextProps.title !== this.state.title // ) { // return true // } // // return false // } renderImageViews() { let imageViews = [] for (let i = 0; i < this.state.imageUrls.length; i ++) { let imageLoader = ( 0 && (i+ 1)%3 === 0) ? 0 : 8}]} options={{ src: this.state.imageUrls[i], }} />) imageViews.push(imageLoader) } return imageViews } render() { return( {'15分钟前'} {this.state.title} { this.props.didClickImageViewContainer() }} style={styles.ImageContainerView}> {this.renderImageViews()} ) } } const styles = StyleSheet.create({ View: { width: ScreenDimensions.width, backgroundColor: 'white' }, TimeText: { fontSize: 13, color: '#6c6c6c', marginTop: 13, marginLeft: 23, }, TitleText: { fontSize: 16, color: '#05120b', marginTop: 13, marginLeft: 23, }, ImageContainerView: { marginTop: 17, width: ScreenDimensions.width - 30, marginLeft: 15, flexDirection: 'row', flexWrap: 'wrap', marginBottom: 10, }, ImageView: { width: (ScreenDimensions.width - 30 - 16)/3.0, height: (ScreenDimensions.width - 30 - 16)/3.0, }, BottomLineView: { width: ScreenDimensions.width, height: 8, backgroundColor: '#efeff4' } })