import _ from 'lodash'; import React from 'react'; import { Text, View, ScrollView } from 'react-native'; import { Avatar, Button, Icon, Theme, withTheme } from 'react-native-elements'; type UserData = { name: string; avatar: string; value: string; positive: boolean; }; const USERS: Partial[] = [ { name: 'John Smith', avatar: 'https://uifaces.co/our-content/donated/1H_7AxP0.jpg', value: '- 164', }, { name: 'Sarah Parker', avatar: 'https://images.pexels.com/photos/598745/pexels-photo-598745.jpeg?crop=faces&fit=crop&h=200&w=200&auto=compress&cs=tinysrgb', value: '+ 203', positive: true, }, { name: 'Barry Allen', avatar: 'https://uifaces.co/our-content/donated/bUkmHPKs.jpg', value: '+ 464', positive: true, }, { name: 'Terry Andrews', avatar: 'https://randomuser.me/api/portraits/men/4.jpg', value: '- 80', positive: false, }, { name: 'Andy Vitale', avatar: 'https://uifaces.co/our-content/donated/NY9hnAbp.jpg', value: '- 230', positive: false, }, { name: 'Katy Friedson', avatar: 'https://images-na.ssl-images-amazon.com/images/M/MV5BMTgxMTc1MTYzM15BMl5BanBnXkFtZTgwNzI5NjMwOTE@._V1_UY256_CR16,0,172,256_AL_.jpg', value: '+ 160', positive: true, }, ]; type ListContentType = { theme?: Theme; }; const ListContent = (props: ListContentType) => { const renderValue = (user: Partial) => { const { value, positive } = user; if (positive) { return ( {value} ); } else { return ( {value} ); } }; const renderCard = (user: Partial, index: React.Key) => { const { name, avatar } = user; return ( {name} {renderValue(user)} ); }; const renderListCards = () => { return _.map(USERS, (user, index) => { return renderCard(user, index); }); }; return ( <> Paul Allen