floorDetail.js 6.47 KB
/**
 * Created by mingming on 8/3/18.
 * 楼层详情
 */
/**
 * Created by mingming on 8/3/18.
 */
import React, { Component } from 'react';
import {
    StyleSheet,
    View,
    Text,
    TouchableOpacity,
    Image,
    ScrollView,
    TextInput,
    FlatList,
    TouchableHighlight
} from 'react-native';

import {zoomW,zoomH} from '../../utils/getSize';
import {xnBorderWidth} from "../../utils/utils";
const back = require('../../img/back.png');
const close = require('../../img/close.png');
const ddd = require('../../img/ddd.png');
const eachMore = require('../../img/eachMore.png');
const video = require('../../img/video.png');

export default class FloorDetail extends Component {
    static navigationOptions = ({ navigation, screenProps })=>({
        title: '1楼',
        headerLeft:(<View style={{display:'flex',flexDirection:'row'}}>
            <TouchableOpacity style={styles.leftIcon}>
                <Image source={back} style={styles.backIcon} resizeMode="contain" />
            </TouchableOpacity>
            <TouchableOpacity style={styles.leftIcon}>
                <Image source={close} style={styles.closeIcon} resizeMode="contain" />
            </TouchableOpacity>
        </View>),
        headerRight:(<View ></View>)
    });

    constructor(props) {
        super(props);
        this.state={
            datas: [{content: 1111, creatTime: '2018-03-05'},
                {content: 2222, creatTime: '2018-03-06'}]
        }

    }

    componentDidMount(){

    };

    //返回首页
    _backHome(){

        this.props.navigation.navigate('Home');
    }

    render() {
        return (
            <View style={{flex:1,display:'flex',alignItems: 'center',flex:1,backgroundColor:'#ffffff'}}>
                <ScrollView style={{flex:1, padding:(15/zoomW)}}>
                    <View style={styles.replay}>
                        <Image source={video} style={styles.avatar} resizeMode="cover" />
                        <View style = {styles.nameBox}>
                            <View style ={{display:'flex',flexDirection:'row',alignItems:'center'}}>
                                <Text style={{fontSize:16,color:'#576b95'}}>张丽</Text>
                                <View style={styles.landlord}>
                                    <Text style={{color:'#808080',fontSize:10}}>楼主</Text>
                                </View>
                            </View>
                            <Image source={eachMore} style={styles.moreIcon} resizeMode="contain" />
                        </View>
                    </View>
                    <View style = {{marginTop:15/zoomH}}>
                        <Text style={{fontSize:18,color:'#000'}} >真是很好的学习资料!学习了,这样的资料应该多一些!</Text>
                        <View style = {{flexDirection:'row',marginTop:6/zoomH}}>
                            <Text style = {{fontSize:12,color:'#999'}}>1</Text>
                            <Text style = {{fontSize:12,color:'#999',marginLeft:10/zoomW}}>回复</Text>
                        </View>
                    </View>
                    <View style={{height:2/zoomH,backgroundColor:'#eeeeee',marginTop:10/zoomH}}/>
                    <View style = {{display:'flex'}}>
                        {this.state.datas && this.state.datas.map((v, i) => this.itemView(v, i))}
                    </View>
                </ScrollView>
                <View style={styles.bottomInput}>
                    <TextInput multiline={true} style={styles.replayInput} placeholder="发表回复…" underlineColorAndroid="transparent" />
                </View>

            </View>
        );
    }


    itemView = (item,index) =>{

        return (
            <View style={{marginTop:20/zoomH}}>
                <Text style={{fontSize:18,color:'#000'}} >{item.content}</Text>
                <View style = {{flexDirection:'row'}}>
                    <Text style = {{fontSize:12,color:'#999'}}>{item.creatTime}</Text>
                    <Text style = {{fontSize:12,color:'#999',marginLeft:20/zoomW}}>回复</Text>
                </View>
            </View>
        )
    }
}



const styles = StyleSheet.create({
    leftIcon:{
        width:(50/zoomW),
        height:'100%',
        display:'flex',
        flexDirection:'row',
        alignItems:'center'
    },
    backIcon:{
        width:(10/zoomW),
        height:(18/zoomH),
        marginLeft:(10/zoomW)
    },
    closeIcon:{
        width:(18/zoomW),
        height:(18/zoomH)
    },
    replayItem:{
        paddingBottom:(20/zoomH),
        borderBottomWidth:xnBorderWidth(),
        borderBottomColor:'#eee',
        borderStyle:'solid'
    },
    replay:{
        display:'flex',
        flexDirection:'row',
        alignItems: 'center',
    },
    landlord:{
        width:(30/zoomW),
        height:(15/zoomH),
        borderWidth:1,
        borderColor:'#808080',
        borderStyle:'solid',
        display:'flex',
        justifyContent:'center',
        alignItems:'center',
        marginLeft:(5/zoomW),
        borderRadius:2
    },
    replayContent:{
        paddingLeft:(62/zoomW),
        paddingRight:(16/zoomW)
    },
    reMark:{
        backgroundColor:'#f4f4f4',
        padding:(10/zoomW)
    },
    bottomInput:{
        width:'100%',
        height:(44/zoomH),
        borderTopWidth:xnBorderWidth(),
        borderTopColor:'#ddd',
        borderStyle:'solid',
        backgroundColor:'#fff',
        paddingLeft:(15/zoomW),
        paddingRight:(15/zoomW),
        display:'flex',
        flexDirection:'row'
    },
    replayInput:{
        width:(200/zoomW),
    },

    content:{
        paddingLeft:(25/zoomW),
        paddingRight:(25/zoomW),
        paddingBottom:(15/zoomH)
    },
    author:{
        display:'flex',
        flexDirection:'row',
        alignItems:'center',
        marginBottom:(25/zoomH),
        marginLeft:-(10/zoomW)
    },
    avatar:{
        width:(36/zoomW),
        height:(36/zoomW),
        marginRight:(10/zoomW),
        borderRadius:2
    },
    moreIcon:{
        alignItems:'flex-end',
        width:(20/zoomW),
        height:(20/zoomW)
    },
    nameBox:{
        width:(295/zoomW),
        display:'flex',
        flexDirection:'row',
        justifyContent:'space-between'
    },
    bottomInput:{
        width:'100%',
        height:(44/zoomH),
        borderTopWidth:xnBorderWidth(),
        borderTopColor:'#ddd',
        borderStyle:'solid',
        backgroundColor:'#fff',
        paddingLeft:(15/zoomW),
        paddingRight:(15/zoomW),
        display:'flex',
        flexDirection:'row'
    },
});