Change design of the peopleResultsView

This commit is contained in:
Furkan Kılıç 2021-01-22 00:18:38 +03:00
parent 09cdfb2d3e
commit c46b699b62
4 changed files with 20 additions and 21 deletions

View File

@ -8,6 +8,7 @@ import styles from './userListItemStyles';
const UserListItem = ({
rightText,
description,
descriptionStyle,
username,
subRightText,
index,
@ -44,7 +45,7 @@ const UserListItem = ({
<UserAvatar noAction={true} style={styles.avatar} username={username} />
<View style={styles.userDescription}>
<Text style={styles.name}>{text || username}</Text>
{description && <Text style={styles.date}>{description}</Text>}
{description && <Text style={[styles.date, descriptionStyle]}>{description}</Text>}
</View>
{middleText && (
<View style={styles.middleWrapper}>

View File

@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
import get from 'lodash/get';
import { withNavigation } from 'react-navigation';
import { connect } from 'react-redux';
import { shuffle } from 'lodash';
import ROUTES from '../../../../../../constants/routeNames';
@ -18,26 +19,12 @@ const PeopleResultsContainer = (props) => {
setNoResult(false);
setUsers([]);
if (searchValue) {
searchAccount(searchValue, 20, 1).then((res) => {
if (res.length === 0) {
setNoResult(true);
}
setUsers(res);
});
} else {
getLeaderboard().then((result) => {
const sos = result.map((item) => {
item.name = item._id;
return item;
});
if (sos.length === 0) {
setNoResult(true);
}
setUsers(sos);
});
}
searchAccount(searchValue, 20, searchValue ? 0 : 1).then((res) => {
if (res.length === 0) {
setNoResult(true);
}
setUsers(res);
});
}, [searchValue]);
// Component Functions

View File

@ -38,6 +38,12 @@ const PeopleResults = ({ navigation, searchValue }) => {
handleOnPress={() => handleOnPress(item)}
index={index}
username={item.name}
text={`@${item.name} ${item.full_name}`}
description={item.about}
descriptionStyle={styles.descriptionStyle}
isHasRightItem
isLoggedIn
isLoadingRightAction={false}
/>
)}
ListEmptyComponent={_renderEmptyContent}

View File

@ -45,4 +45,9 @@ export default EStyleSheet.create({
marginLeft: 15,
color: '$primaryBlack',
},
descriptionStyle: {
maxWidth: '$deviceWidth',
marginTop: 4,
marginRight: 24,
},
});