aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/screens/profile/InviteFriendsScreen.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx
index 36aa8ada..b68da127 100644
--- a/src/screens/profile/InviteFriendsScreen.tsx
+++ b/src/screens/profile/InviteFriendsScreen.tsx
@@ -90,14 +90,18 @@ const InviteFriendsScreen: React.FC<InviteFriendsScreenProps> = ({route}) => {
if (query.length > 0) {
const searchResultsUsers = usersFromContacts.filter(
(item: ProfilePreviewType) =>
- item.first_name.toLowerCase().includes(query) ||
- item.last_name.toLowerCase().includes(query) ||
- item.username.toLowerCase().includes(query),
+ item.last_name.toLowerCase().startsWith(query) ||
+ (item.first_name + ' ' + item.last_name)
+ .toLowerCase()
+ .startsWith(query) ||
+ item.username.toLowerCase().startsWith(query),
);
const searchResultsNonUsers = nonUsersFromContacts.filter(
(item) =>
- item.firstName.toLowerCase().includes(query) ||
- item.lastName.toLowerCase().includes(query),
+ item.lastName.toLowerCase().includes(query) ||
+ (item.firstName + ' ' + item.lastName)
+ .toLowerCase()
+ .includes(query),
);
const sanitizedResult = {
usersFromContacts: searchResultsUsers,