/**
 * 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 {
  Container,
  List,
  ListItem,
  Left,
  Thumbnail,
  Body,
  Text,
} from 'native-base';
import styles from './style';
import { FlatList } from 'react-native';

const WhatsappContactListView = (props: { chatUser: any[] }) => {
  return (
    <Container>
      <FlatList
        data={props.chatUser}
        keyExtractor={(item, index) => index.toString()}
        renderItem={({ item: user }) =>(
          <ListItem avatar>
            <Left>
              <Thumbnail source={user.image} />
            </Left>
            <Body style={[styles.bodySection, styles.noBottonBorder]}>
              <Text style={styles.userName}>{user.name}</Text>
              <Text style={styles.userDesc} numberOfLines={1}>
                {user.description}
              </Text>
            </Body>
          </ListItem>
        )}
      />
    </Container>
  );
};

export default WhatsappContactListView;
