ContentFansListCell.js 2.99 KB
/**
 * Created by zzz on 2019/3/12.
 */
'use strict';

import React, {Component} from 'react';
import {Dimensions, Image, StyleSheet, Text, TouchableOpacity, View, NativeModules} from 'react-native';
import {Immutable} from "immutable";
import YH_Image from '../../../common/components/YH_Image';

export default class ContentFansListCell extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        let ico = 'http://head.static.yhbimg.com/yhb-head/2018/07/02/16/01fc258bbe83d5b332f3b2631897b80ec9.591188.jpg?imageView2/{mode}/w/{width}/h/{height}';
        let imageUrl = YH_Image.getSlicedUrl(ico, 50, 50, 2);

        function onHeadIconPress() {
          console.log('onHeadIconPress');
        }

        function onFanPress() {
          console.log('onFanPress');
        }

        return (
          <View>
              <View style={styles.headerBackground}>
                  <TouchableOpacity activeOpacity={1} onPress={()=> {onHeadIconPress()}}>
                      <YH_Image style={styles.headIcon} url={imageUrl} circle={true}/>
                  </TouchableOpacity>

                  <View style={styles.textView}>
                      <Text>
                        <Text style={styles.nicknameText}>PINKA</Text>
                        <Text style={styles.defaultReplyText} numberOfLines={2}> 关注了你</Text>
                      </Text>
                      <Text style={styles.startTimeText}>{'2018.03.05 10:00:00'}</Text>
                  </View>
                  <TouchableOpacity activeOpacity={1} style={styles.fanContainer} onPress={()=> {onFanPress()}}>
                      <Image style={styles.fanImage} source={require('../../images/content_fan.png')}/>
                  </TouchableOpacity>
              </View>
              <View style={styles.lineView}/>
          </View>
        );
    }
}

let { width, height } = Dimensions.get('window');
const DEVICE_HEIGHT_RATIO = height / 667;

let styles = StyleSheet.create({
    headerBackground: {
      width: width,
      height: 80,
      backgroundColor: 'white',
      flexDirection: 'row',
    },
    headIcon: {
      width: 50,
      height: 50,
      marginLeft: 15,
      marginTop: 15,
      marginRight:15,
      overflow: 'hidden',
      borderRadius: 25,
    },
    textView: {
      flexDirection: 'column',
      justifyContent: 'space-between',
      alignItems: 'flex-start',
      marginTop: 15,
      marginBottom: 20,
    },
    startTimeText: {
      fontFamily: 'PingFang-SC-Regular',
      fontSize: 12,
      color: '#B0B0B0',
      height: 17
    },
    nicknameText: {
      fontSize: 14,
      fontFamily: 'PingFang-SC-Medium',
      color: 'black',
      fontWeight: 'bold'
    },
    fanContainer: {
      position: 'absolute',
      top: 27,
      right: 15,
      width: 60,
      height: 25,
    },
    fanImage: {
      width: 60,
      height: 25,
    },
    lineView: {
      marginLeft:15,
      marginRight: 0,
      width: width-15,
      height: 1,
      backgroundColor: '#e0e0e0'
    },
  });