|
@@ -1,7 +1,6 @@
|
|
import React, { useEffect, useState } from 'react';
|
|
import React, { useEffect, useState } from 'react';
|
|
import {
|
|
import {
|
|
View,
|
|
View,
|
|
- TextInput,
|
|
|
|
Text,
|
|
Text,
|
|
Image,
|
|
Image,
|
|
TouchableOpacity,
|
|
TouchableOpacity,
|
|
@@ -9,7 +8,7 @@ import {
|
|
ActivityIndicator,
|
|
ActivityIndicator,
|
|
Platform
|
|
Platform
|
|
} from 'react-native';
|
|
} from 'react-native';
|
|
-import ActionSheet from 'react-native-actions-sheet';
|
|
|
|
|
|
+import ActionSheet, { SheetManager } from 'react-native-actions-sheet';
|
|
import { FlashList } from '@shopify/flash-list';
|
|
import { FlashList } from '@shopify/flash-list';
|
|
import { storage, StoreType } from 'src/storage';
|
|
import { storage, StoreType } from 'src/storage';
|
|
import { usePostSearchUsers } from '@api/chat';
|
|
import { usePostSearchUsers } from '@api/chat';
|
|
@@ -17,6 +16,10 @@ import { API_HOST } from 'src/constants';
|
|
import { Colors } from 'src/theme';
|
|
import { Colors } from 'src/theme';
|
|
import { useNavigation } from '@react-navigation/native';
|
|
import { useNavigation } from '@react-navigation/native';
|
|
import { NAVIGATION_PAGES } from 'src/types';
|
|
import { NAVIGATION_PAGES } from 'src/types';
|
|
|
|
+import { getFontSize } from 'src/utils';
|
|
|
|
+import { AvatarWithInitials, Input } from 'src/components';
|
|
|
|
+
|
|
|
|
+import SearchIcon from 'assets/icons/search.svg';
|
|
|
|
|
|
const SearchModal = () => {
|
|
const SearchModal = () => {
|
|
const navigation = useNavigation();
|
|
const navigation = useNavigation();
|
|
@@ -33,7 +36,8 @@ const SearchModal = () => {
|
|
const renderItem = ({ item }: { item: any }) => (
|
|
const renderItem = ({ item }: { item: any }) => (
|
|
<TouchableOpacity
|
|
<TouchableOpacity
|
|
style={styles.itemContainer}
|
|
style={styles.itemContainer}
|
|
- onPress={() =>
|
|
|
|
|
|
+ onPress={() => {
|
|
|
|
+ SheetManager.hide('search-modal');
|
|
navigation.navigate(
|
|
navigation.navigate(
|
|
...([
|
|
...([
|
|
NAVIGATION_PAGES.CHAT,
|
|
NAVIGATION_PAGES.CHAT,
|
|
@@ -43,10 +47,20 @@ const SearchModal = () => {
|
|
avatar: item.avatar
|
|
avatar: item.avatar
|
|
}
|
|
}
|
|
] as never)
|
|
] as never)
|
|
- )
|
|
|
|
- }
|
|
|
|
|
|
+ );
|
|
|
|
+ }}
|
|
>
|
|
>
|
|
- <Image source={{ uri: API_HOST + item.avatar }} style={styles.avatar} />
|
|
|
|
|
|
+ {item.avatar ? (
|
|
|
|
+ <Image source={{ uri: API_HOST + item.avatar }} style={styles.avatar} />
|
|
|
|
+ ) : (
|
|
|
|
+ <AvatarWithInitials
|
|
|
|
+ text={`${item.first_name[0] ?? ''}${item.last_name[0] ?? ''}`}
|
|
|
|
+ flag={API_HOST + item.homebase_flag}
|
|
|
|
+ size={28}
|
|
|
|
+ fontSize={12}
|
|
|
|
+ />
|
|
|
|
+ )}
|
|
|
|
+
|
|
<View style={styles.textContainer}>
|
|
<View style={styles.textContainer}>
|
|
<Text style={styles.name}>
|
|
<Text style={styles.name}>
|
|
{item.first_name} {item.last_name}
|
|
{item.first_name} {item.last_name}
|
|
@@ -65,17 +79,18 @@ const SearchModal = () => {
|
|
indicatorStyle={{ backgroundColor: 'transparent' }}
|
|
indicatorStyle={{ backgroundColor: 'transparent' }}
|
|
>
|
|
>
|
|
<View style={styles.container}>
|
|
<View style={styles.container}>
|
|
- <TextInput
|
|
|
|
- style={styles.searchInput}
|
|
|
|
- placeholder="Search nomads"
|
|
|
|
- value={searchQuery}
|
|
|
|
- onChangeText={(text) => {
|
|
|
|
|
|
+ <Input
|
|
|
|
+ inputMode={'search'}
|
|
|
|
+ placeholder={'Search nomads'}
|
|
|
|
+ onChange={(text) => {
|
|
setSearchQuery(text);
|
|
setSearchQuery(text);
|
|
}}
|
|
}}
|
|
|
|
+ value={searchQuery}
|
|
|
|
+ icon={<SearchIcon fill={'#C8C8C8'} width={14} height={14} />}
|
|
/>
|
|
/>
|
|
|
|
|
|
{isFetching ? (
|
|
{isFetching ? (
|
|
- <ActivityIndicator size="large" color="#0000ff" />
|
|
|
|
|
|
+ <ActivityIndicator size="large" color={Colors.DARK_BLUE} />
|
|
) : (
|
|
) : (
|
|
<View style={{ flex: 1 }}>
|
|
<View style={{ flex: 1 }}>
|
|
<FlashList
|
|
<FlashList
|
|
@@ -104,7 +119,8 @@ const styles = StyleSheet.create({
|
|
height: '80%',
|
|
height: '80%',
|
|
borderTopLeftRadius: 15,
|
|
borderTopLeftRadius: 15,
|
|
borderTopRightRadius: 15,
|
|
borderTopRightRadius: 15,
|
|
- paddingHorizontal: 16
|
|
|
|
|
|
+ paddingHorizontal: 16,
|
|
|
|
+ paddingVertical: 12
|
|
},
|
|
},
|
|
container: {
|
|
container: {
|
|
backgroundColor: 'white',
|
|
backgroundColor: 'white',
|
|
@@ -122,24 +138,23 @@ const styles = StyleSheet.create({
|
|
itemContainer: {
|
|
itemContainer: {
|
|
flexDirection: 'row',
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
alignItems: 'center',
|
|
- paddingVertical: 10,
|
|
|
|
- borderBottomColor: '#ccc',
|
|
|
|
- borderBottomWidth: 1
|
|
|
|
|
|
+ paddingVertical: 12,
|
|
|
|
+ gap: 8
|
|
},
|
|
},
|
|
avatar: {
|
|
avatar: {
|
|
- width: 48,
|
|
|
|
- height: 48,
|
|
|
|
- borderRadius: 24,
|
|
|
|
|
|
+ width: 28,
|
|
|
|
+ height: 28,
|
|
|
|
+ borderRadius: 14,
|
|
borderWidth: 1,
|
|
borderWidth: 1,
|
|
- borderColor: Colors.FILL_LIGHT,
|
|
|
|
- marginRight: 15
|
|
|
|
|
|
+ borderColor: Colors.FILL_LIGHT
|
|
},
|
|
},
|
|
textContainer: {
|
|
textContainer: {
|
|
flex: 1
|
|
flex: 1
|
|
},
|
|
},
|
|
name: {
|
|
name: {
|
|
- fontSize: 16,
|
|
|
|
- fontWeight: 'bold'
|
|
|
|
|
|
+ fontSize: getFontSize(14),
|
|
|
|
+ color: Colors.DARK_BLUE,
|
|
|
|
+ fontFamily: 'montserrat-700'
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|