CalendarTrigger.js 1.38 KB
'use strict';

import React from 'react';
import ReactNative from 'react-native';
const {
    Component,
} = React;

const {
    StyleSheet,
    TouchableOpacity,
    Text,
    Image,
} = ReactNative;

export default class CalendarTrigger extends Component {

    static propTypes = {
        date: React.PropTypes.string.isRequired,
        toogleSelector: React.PropTypes.func,
    };

    constructor(props) {
        super(props);

        this.onPress = this.onPress.bind(this);
    }

    onPress() {
        this.props.toogleSelector && this.props.toogleSelector();
    }

    render() {

        return (
            <TouchableOpacity
                activeOpacity={0.5}
                style={styles.container}
                onPress={this.onPress}>
                <Text style={styles.text}>{this.props.date}</Text>
                <Image source={require('./cal_sel.png')} style={styles.thumb} />
            </TouchableOpacity>
        );
    }
}

let styles = StyleSheet.create({
    container: {
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: 'white',
        height: 45,
        borderBottomWidth: 0.5,
        borderBottomColor: '#B0B0B0',
    },
    text: {
        fontSize: 14,
        color: '#444444',
        textAlign: 'center',
    },
    thumb: {
        left: 5,
        width: 15,
        height: 15,
    },
});