/**
 * React Native Full App (https://store.enappd.com/product/react-native-full-app)
 *
 * Copyright © 2019-present Enappd. All rights reserved.
 *
 * This source code is licensed as per the terms found in the
 * LICENSE.md file in the root directory of this source tree.
 */
import React, { Component } from 'react';
import WhatsappListView from './whatsappListView';

interface WhatsAppListState {
  searchIcon: boolean;
}

export default class WhatsappListContainer extends Component<
  any,
  WhatsAppListState
> {
  constructor(props: any) {
    super(props);
    this.state = {
      searchIcon: false,
    };
  }
  headerTitle = 'WhatsApp';
  unreadMessage = 19;
  tabs = [
    { title: 'CALLS' },
    { title: 'CHATS', message: 17 },
    { title: 'CONTACTS' },
  ];
  openSideMenu = () => {
    console.log('DrawerOpen');
    this.props.navigation.toggleDrawer();
  };

  pressAction = (item: string) => {
    console.log('press Event');
    const { searchIcon } = this.state;
    switch (item) {
      case 'search':
        // eslint-disable-next-line no-return-assign
        return this.setState({ searchIcon: !searchIcon });

      default:
        return '';
    }
  };
  render() {
    return (
      <WhatsappListView
        headerTitle={this.headerTitle}
        pressAction={this.pressAction}
        searchIcon={this.state.searchIcon}
        unreadMessage={this.unreadMessage}
        openSideMenu={this.openSideMenu}
      />
    );
  }
}
