import React, { Component } from 'react';
import { TouchableOpacity } from 'react-native';
import { View, Text } from 'native-base';
import { appointmentDelete } from './../actions'
import { connect } from 'react-redux';
import moment from 'moment';

class ListItem extends Component {

    constructor(props) {
        super(props)
    }

    deleteAppointment(id) {
        this.props.appointmentDelete(id)
    }

    render() {
        return (
            <TouchableOpacity onPress={() => this.deleteAppointment(this.props.data.id)}>
                <View>
                    <Text>{this.props.data.doctorName}</Text>
                    <Text>{this.props.data.date}</Text>
                    <Text>{this.props.data.time}</Text>
                    <Text>{this.props.data.place}</Text>
                </View>
            </TouchableOpacity>
        )
    }
}

export default connect(null, { appointmentDelete })(ListItem);