ScreenSubCell.js 1.63 KB
'use strict';

import React from 'react';
import ReactNative from 'react-native';
import Immutable, {Map} from 'immutable';
import DeviceInfo from 'react-native-device-info';

const {
    View,
    Text,
    TouchableOpacity,
    Dimensions,
    StyleSheet,
	Platform,
	Image,
} = ReactNative;

export default class ScreenSubCell extends React.Component {

    constructor(props) {
        super (props);
    }

    render() {
		let resource = this.props.resource?this.props.resource.toJS():null;
		if (!resource) {
			return null;
		}
		let isSelect = resource.isSelect;
        let key = resource.key;
        let name = resource.name;

		return (
			<View style={styles.container}>
				<TouchableOpacity onPress={() => {console.log('aaaaaaa');}} >
					<View style={styles.cell}>
						<Text style={styles.name}>{name}</Text>
						<Image style={styles.arrow} source={require('../../images/arrow_gray.png')}></Image>
					</View>
					<View style={{width: width,height: 0.5,backgroundColor: 'rgb(235, 235, 235)'}}/>
				</TouchableOpacity>
			</View>
		);
    }
}

let {width, height} = Dimensions.get('window');
let backgroundWidth = width;
let backgroundHeight = 40;
let rightOffset = 50;

let styles = StyleSheet.create({
	container: {
		width: backgroundWidth,
		height: backgroundHeight,
		alignItems: 'center',
	},

	cell: {
		width: backgroundWidth,
		height: backgroundHeight-0.5,
		backgroundColor: '#f0f0f0',
		flexDirection: 'row',
		alignItems: 'center',
	},
	name: {
		marginLeft: 10,
		color: 'rgb(146, 146, 146)'
	},
	arrow: {
		height: 12,
		position: 'absolute',
		marginVertical: (backgroundHeight - 12 )/2,
		right: 10 + rightOffset,
	},
});