|
@@ -28,7 +28,6 @@ import { SheetManager } from 'react-native-actions-sheet';
|
|
|
import MoreModal from './Components/MoreModal';
|
|
import MoreModal from './Components/MoreModal';
|
|
|
import SearchIcon from 'assets/icons/search.svg';
|
|
import SearchIcon from 'assets/icons/search.svg';
|
|
|
import { storage, StoreType } from 'src/storage';
|
|
import { storage, StoreType } from 'src/storage';
|
|
|
-import { usePostGetBlockedQuery, usePostGetChatsListQuery } from '@api/chat';
|
|
|
|
|
import { Blocked, Chat } from './types';
|
|
import { Blocked, Chat } from './types';
|
|
|
|
|
|
|
|
import PinIcon from 'assets/icons/messages/pin.svg';
|
|
import PinIcon from 'assets/icons/messages/pin.svg';
|
|
@@ -45,9 +44,41 @@ import GroupIcon from 'assets/icons/messages/group-chat.svg';
|
|
|
import { usePushNotification } from 'src/contexts/PushNotificationContext';
|
|
import { usePushNotification } from 'src/contexts/PushNotificationContext';
|
|
|
import { useChatsListLive } from 'src/watermelondb/features/chat/hooks/useChatsList';
|
|
import { useChatsListLive } from 'src/watermelondb/features/chat/hooks/useChatsList';
|
|
|
import { syncChatsIncremental } from 'src/watermelondb/features/chat/data/chat.sync';
|
|
import { syncChatsIncremental } from 'src/watermelondb/features/chat/data/chat.sync';
|
|
|
-import NetInfo from '@react-native-community/netinfo';
|
|
|
|
|
import { useBlockedUsersLive } from 'src/watermelondb/features/chat/hooks/useBlockedUsersLive';
|
|
import { useBlockedUsersLive } from 'src/watermelondb/features/chat/hooks/useBlockedUsersLive';
|
|
|
-import { testConnectionSpeed } from 'src/database/speedService';
|
|
|
|
|
|
|
+import { useMessageSearch } from 'src/watermelondb/features/chat/hooks/useMessagesSearch';
|
|
|
|
|
+
|
|
|
|
|
+export function highlightText(text: string, query: string, highlightStyle: any) {
|
|
|
|
|
+ if (!query.trim()) return <Text>{text}</Text>;
|
|
|
|
|
+
|
|
|
|
|
+ const lowerText = text.toLowerCase();
|
|
|
|
|
+ const lowerQuery = query.toLowerCase();
|
|
|
|
|
+
|
|
|
|
|
+ const parts: React.ReactNode[] = [];
|
|
|
|
|
+ let lastIndex = 0;
|
|
|
|
|
+
|
|
|
|
|
+ let index = lowerText.indexOf(lowerQuery);
|
|
|
|
|
+
|
|
|
|
|
+ while (index !== -1) {
|
|
|
|
|
+ if (index > lastIndex) {
|
|
|
|
|
+ parts.push(text.slice(lastIndex, index));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ parts.push(
|
|
|
|
|
+ <Text key={index} style={highlightStyle}>
|
|
|
|
|
+ {text.slice(index, index + query.length)}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ lastIndex = index + query.length;
|
|
|
|
|
+ index = lowerText.indexOf(lowerQuery, lastIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (lastIndex < text.length) {
|
|
|
|
|
+ parts.push(text.slice(lastIndex));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return <Text>{parts}</Text>;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const TypingIndicator = ({ name }: { name?: string }) => {
|
|
const TypingIndicator = ({ name }: { name?: string }) => {
|
|
|
const [dots, setDots] = useState('');
|
|
const [dots, setDots] = useState('');
|
|
@@ -106,6 +137,16 @@ const MessagesScreen = () => {
|
|
|
|
|
|
|
|
const socket = useRef<WebSocket | null>(null);
|
|
const socket = useRef<WebSocket | null>(null);
|
|
|
|
|
|
|
|
|
|
+ const [debouncedSearch, setDebouncedSearch] = useState('');
|
|
|
|
|
+
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ const t = setTimeout(() => {
|
|
|
|
|
+ setDebouncedSearch(search);
|
|
|
|
|
+ }, 300);
|
|
|
|
|
+
|
|
|
|
|
+ return () => clearTimeout(t);
|
|
|
|
|
+ }, [search]);
|
|
|
|
|
+
|
|
|
const initializeSocket = () => {
|
|
const initializeSocket = () => {
|
|
|
if (socket.current) {
|
|
if (socket.current) {
|
|
|
socket.current.close();
|
|
socket.current.close();
|
|
@@ -251,22 +292,24 @@ const MessagesScreen = () => {
|
|
|
openRowRef.current = ref;
|
|
openRowRef.current = ref;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- useFocusEffect(() => {
|
|
|
|
|
- const isKeyboardVisible = Keyboard.isVisible();
|
|
|
|
|
- if (isKeyboardVisible) {
|
|
|
|
|
- Keyboard.dismiss();
|
|
|
|
|
- }
|
|
|
|
|
- navigation.getParent()?.setOptions({
|
|
|
|
|
- tabBarStyle: {
|
|
|
|
|
- display: 'flex',
|
|
|
|
|
- ...Platform.select({
|
|
|
|
|
- android: {
|
|
|
|
|
- // height: 58
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ useFocusEffect(
|
|
|
|
|
+ useCallback(() => {
|
|
|
|
|
+ const isKeyboardVisible = Keyboard.isVisible();
|
|
|
|
|
+ if (isKeyboardVisible) {
|
|
|
|
|
+ Keyboard.dismiss();
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ navigation.getParent()?.setOptions({
|
|
|
|
|
+ tabBarStyle: {
|
|
|
|
|
+ display: 'flex',
|
|
|
|
|
+ ...Platform.select({
|
|
|
|
|
+ android: {
|
|
|
|
|
+ // height: 58
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }, [])
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
useFocusEffect(
|
|
useFocusEffect(
|
|
|
useCallback(() => {
|
|
useCallback(() => {
|
|
@@ -309,91 +352,143 @@ const MessagesScreen = () => {
|
|
|
return getFilteredChats(routes[index].key);
|
|
return getFilteredChats(routes[index].key);
|
|
|
}, [index, chats]);
|
|
}, [index, chats]);
|
|
|
|
|
|
|
|
- // const searchFilter = (text: string) => {
|
|
|
|
|
- // if (text) {
|
|
|
|
|
- // const newData =
|
|
|
|
|
- // chats?.filter((item: Chat) => {
|
|
|
|
|
- // const itemData = item.short ? item.short.toLowerCase() : ''.toLowerCase();
|
|
|
|
|
- // const textData = text.toLowerCase();
|
|
|
|
|
- // return itemData.indexOf(textData) > -1;
|
|
|
|
|
- // }) ?? [];
|
|
|
|
|
- // setFilteredChats((prev) => ({ ...prev, [routes[index].key]: newData }));
|
|
|
|
|
- // setSearch(text);
|
|
|
|
|
- // } else {
|
|
|
|
|
- // filterChatsByTab();
|
|
|
|
|
- // setSearch(text);
|
|
|
|
|
- // }
|
|
|
|
|
- // };
|
|
|
|
|
-
|
|
|
|
|
- const renderChatItem = ({ item }: { item: Chat }) => {
|
|
|
|
|
|
|
+ type ChatSearchResult =
|
|
|
|
|
+ | {
|
|
|
|
|
+ type: 'chat';
|
|
|
|
|
+ chat: Chat;
|
|
|
|
|
+ }
|
|
|
|
|
+ | {
|
|
|
|
|
+ type: 'message';
|
|
|
|
|
+ chat: Chat;
|
|
|
|
|
+ messageId: number;
|
|
|
|
|
+ messageText: string;
|
|
|
|
|
+ messageTime: number;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const messageSearchResults = useMessageSearch(debouncedSearch);
|
|
|
|
|
+
|
|
|
|
|
+ const searchedChats: ChatSearchResult[] = useMemo(() => {
|
|
|
|
|
+ if (!debouncedSearch.trim()) {
|
|
|
|
|
+ return filteredChatsForCurrentTab.map((chat) => ({
|
|
|
|
|
+ type: 'chat',
|
|
|
|
|
+ chat
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const q = debouncedSearch.toLowerCase();
|
|
|
|
|
+ const results: ChatSearchResult[] = [];
|
|
|
|
|
+
|
|
|
|
|
+ for (const chat of filteredChatsForCurrentTab) {
|
|
|
|
|
+ if (chat.name?.toLowerCase().includes(q) || chat.short?.toLowerCase().includes(q)) {
|
|
|
|
|
+ results.push({
|
|
|
|
|
+ type: 'chat',
|
|
|
|
|
+ chat
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (const m of messageSearchResults) {
|
|
|
|
|
+ const chat = filteredChatsForCurrentTab.find((c) => {
|
|
|
|
|
+ const key = c.groupChatToken ? `g:${c.groupChatToken}` : `u:${c.chatUid}`;
|
|
|
|
|
+ return key === m.chatKey;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (!chat) continue;
|
|
|
|
|
+
|
|
|
|
|
+ results.push({
|
|
|
|
|
+ type: 'message',
|
|
|
|
|
+ chat,
|
|
|
|
|
+ messageId: m.messageId,
|
|
|
|
|
+ messageText: m.text,
|
|
|
|
|
+ messageTime: m.sentAt
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return results;
|
|
|
|
|
+ }, [filteredChatsForCurrentTab, debouncedSearch, messageSearchResults]);
|
|
|
|
|
+
|
|
|
|
|
+ const searchFilter = (text: string) => {
|
|
|
|
|
+ if (text) {
|
|
|
|
|
+ setSearch(text);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setSearch(text);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const renderChatItem = ({ item }: { item: ChatSearchResult }) => {
|
|
|
const name =
|
|
const name =
|
|
|
- item.userType === 'blocked'
|
|
|
|
|
|
|
+ item.chat.userType === 'blocked'
|
|
|
? 'Account is blocked'
|
|
? 'Account is blocked'
|
|
|
- : item.userType === 'not_exist'
|
|
|
|
|
|
|
+ : item.chat.userType === 'not_exist'
|
|
|
? 'Account does not exist'
|
|
? 'Account does not exist'
|
|
|
- : item.name;
|
|
|
|
|
|
|
+ : item.chat.name;
|
|
|
|
|
+
|
|
|
|
|
+ const previewText = item.type === 'message' ? item.messageText : item.chat.short;
|
|
|
|
|
+
|
|
|
|
|
+ const previewTime = item.type === 'message' ? item.messageTime : item.chat.updated;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<SwipeableRow
|
|
<SwipeableRow
|
|
|
chat={{
|
|
chat={{
|
|
|
- uid: item.chatUid,
|
|
|
|
|
- groupToken: item.groupChatToken,
|
|
|
|
|
- name: item.name,
|
|
|
|
|
- avatar: item.avatar,
|
|
|
|
|
- pin: item.pin,
|
|
|
|
|
- archive: item.archive,
|
|
|
|
|
- muted: item.muted,
|
|
|
|
|
- userType: item.userType ?? 'normal',
|
|
|
|
|
- announcement: item.announcement
|
|
|
|
|
|
|
+ uid: item.chat.chatUid,
|
|
|
|
|
+ groupToken: item.chat.groupChatToken,
|
|
|
|
|
+ name: item.chat.name,
|
|
|
|
|
+ avatar: item.chat.avatar,
|
|
|
|
|
+ pin: item.chat.pin,
|
|
|
|
|
+ archive: item.chat.archive,
|
|
|
|
|
+ muted: item.chat.muted,
|
|
|
|
|
+ userType: item.chat.userType ?? 'normal',
|
|
|
|
|
+ announcement: item.chat.announcement
|
|
|
}}
|
|
}}
|
|
|
token={token}
|
|
token={token}
|
|
|
onRowOpen={handleRowOpen}
|
|
onRowOpen={handleRowOpen}
|
|
|
>
|
|
>
|
|
|
<TouchableHighlight
|
|
<TouchableHighlight
|
|
|
key={
|
|
key={
|
|
|
- item.chatUid
|
|
|
|
|
- ? `${item.chatUid}-${typingUsers[item.chatUid]}`
|
|
|
|
|
- : `${item.groupChatToken}-${typingUsers[item.groupChatToken ?? '']}`
|
|
|
|
|
|
|
+ item.chat.chatUid
|
|
|
|
|
+ ? `${item.chat.chatUid}-${typingUsers[item.chat.chatUid]}`
|
|
|
|
|
+ : `${item.chat.groupChatToken}-${typingUsers[item.chat.groupChatToken ?? '']}`
|
|
|
}
|
|
}
|
|
|
activeOpacity={0.8}
|
|
activeOpacity={0.8}
|
|
|
onPress={() => {
|
|
onPress={() => {
|
|
|
navigation.navigate(
|
|
navigation.navigate(
|
|
|
- item.groupChatToken ? NAVIGATION_PAGES.GROUP_CHAT : NAVIGATION_PAGES.CHAT,
|
|
|
|
|
|
|
+ item.chat.groupChatToken ? NAVIGATION_PAGES.GROUP_CHAT : NAVIGATION_PAGES.CHAT,
|
|
|
{
|
|
{
|
|
|
- id: item.chatUid,
|
|
|
|
|
- group_token: item.groupChatToken,
|
|
|
|
|
- name: item.name,
|
|
|
|
|
- avatar: item.avatar,
|
|
|
|
|
- userType: item.userType ?? 'normal',
|
|
|
|
|
- announcement: item.announcement
|
|
|
|
|
|
|
+ id: item.chat.chatUid,
|
|
|
|
|
+ group_token: item.chat.groupChatToken,
|
|
|
|
|
+ name: item.chat.name,
|
|
|
|
|
+ avatar: item.chat.avatar,
|
|
|
|
|
+ userType: item.chat.userType ?? 'normal',
|
|
|
|
|
+ announcement: item.chat.announcement,
|
|
|
|
|
+ scrollToMessageId: item?.messageId ?? null
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
}}
|
|
}}
|
|
|
underlayColor={Colors.FILL_LIGHT}
|
|
underlayColor={Colors.FILL_LIGHT}
|
|
|
>
|
|
>
|
|
|
<View style={styles.chatItem}>
|
|
<View style={styles.chatItem}>
|
|
|
- {item.avatar && (item.userType === 'normal' || !item.userType) ? (
|
|
|
|
|
|
|
+ {item.chat.avatar && (item.chat.userType === 'normal' || !item.chat.userType) ? (
|
|
|
<Image
|
|
<Image
|
|
|
source={{
|
|
source={{
|
|
|
- uri: item.groupChatToken
|
|
|
|
|
- ? `${API_HOST}${item.avatar}?cacheBust=${cacheKey}`
|
|
|
|
|
- : `${API_HOST}${item.avatar}`
|
|
|
|
|
|
|
+ uri: item.chat.groupChatToken
|
|
|
|
|
+ ? `${API_HOST}${item.chat.avatar}?cacheBust=${cacheKey}`
|
|
|
|
|
+ : `${API_HOST}${item.chat.avatar}`
|
|
|
}}
|
|
}}
|
|
|
style={styles.avatar}
|
|
style={styles.avatar}
|
|
|
onError={(e) => console.warn('Image error', e.nativeEvent)}
|
|
onError={(e) => console.warn('Image error', e.nativeEvent)}
|
|
|
/>
|
|
/>
|
|
|
- ) : item.chatUid && (item.userType === 'normal' || !item.userType) ? (
|
|
|
|
|
|
|
+ ) : item.chat.chatUid && (item.chat.userType === 'normal' || !item.chat.userType) ? (
|
|
|
<AvatarWithInitials
|
|
<AvatarWithInitials
|
|
|
text={
|
|
text={
|
|
|
- item.name
|
|
|
|
|
|
|
+ item.chat.name
|
|
|
?.split(/ (.+)/)
|
|
?.split(/ (.+)/)
|
|
|
.map((n) => n[0])
|
|
.map((n) => n[0])
|
|
|
.join('') ?? ''
|
|
.join('') ?? ''
|
|
|
}
|
|
}
|
|
|
- flag={API_HOST + item?.flag}
|
|
|
|
|
|
|
+ flag={API_HOST + item.chat?.flag}
|
|
|
size={54}
|
|
size={54}
|
|
|
/>
|
|
/>
|
|
|
- ) : item.userType === 'normal' || !item.userType ? (
|
|
|
|
|
|
|
+ ) : item.chat.userType === 'normal' || !item.chat.userType ? (
|
|
|
<GroupIcon fill={Colors.DARK_BLUE} width={54} height={54} />
|
|
<GroupIcon fill={Colors.DARK_BLUE} width={54} height={54} />
|
|
|
) : (
|
|
) : (
|
|
|
<BanIcon fill={Colors.RED} width={54} height={54} />
|
|
<BanIcon fill={Colors.RED} width={54} height={54} />
|
|
@@ -404,46 +499,51 @@ const MessagesScreen = () => {
|
|
|
<Text
|
|
<Text
|
|
|
style={[
|
|
style={[
|
|
|
styles.chatName,
|
|
styles.chatName,
|
|
|
- item.userType === 'not_exist' || item.userType === 'blocked'
|
|
|
|
|
|
|
+ item.chat.userType === 'not_exist' || item.chat.userType === 'blocked'
|
|
|
? { color: Colors.RED }
|
|
? { color: Colors.RED }
|
|
|
: {}
|
|
: {}
|
|
|
]}
|
|
]}
|
|
|
>
|
|
>
|
|
|
- {name}
|
|
|
|
|
|
|
+ {highlightText(name, debouncedSearch, { backgroundColor: '#FFE58A' })}
|
|
|
</Text>
|
|
</Text>
|
|
|
|
|
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
|
|
- {item.pin === 1 ? <PinIcon height={12} fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
|
- {item.muted === 1 ? <BellSlashIcon height={12} fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
|
|
|
+ {item.chat.pin === 1 ? <PinIcon height={12} fill={Colors.DARK_BLUE} /> : null}
|
|
|
|
|
+ {item.chat.muted === 1 ? (
|
|
|
|
|
+ <BellSlashIcon height={12} fill={Colors.DARK_BLUE} />
|
|
|
|
|
+ ) : null}
|
|
|
|
|
|
|
|
- {item.sentBy === +currentUserId && item.status === 3 ? (
|
|
|
|
|
|
|
+ {item.chat.sentBy === +currentUserId && item.chat.status === 3 ? (
|
|
|
<ReadIcon fill={Colors.DARK_BLUE} />
|
|
<ReadIcon fill={Colors.DARK_BLUE} />
|
|
|
- ) : item.sentBy === +currentUserId && (item.status === 2 || item.status === 1) ? (
|
|
|
|
|
|
|
+ ) : item.chat.sentBy === +currentUserId &&
|
|
|
|
|
+ (item.chat.status === 2 || item.chat.status === 1) ? (
|
|
|
<UnreadIcon fill={Colors.LIGHT_GRAY} />
|
|
<UnreadIcon fill={Colors.LIGHT_GRAY} />
|
|
|
) : null}
|
|
) : null}
|
|
|
- <Text style={styles.chatTime}>{formatDate(item.updated)}</Text>
|
|
|
|
|
|
|
+ <Text style={styles.chatTime}>{formatDate(previewTime)}</Text>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
|
|
|
|
|
<View style={[styles.rowContainer, { flex: 1, gap: 6 }]}>
|
|
<View style={[styles.rowContainer, { flex: 1, gap: 6 }]}>
|
|
|
- {item.chatUid && typingUsers[item.chatUid] ? (
|
|
|
|
|
|
|
+ {item.chat.chatUid && typingUsers[item.chat.chatUid] ? (
|
|
|
<TypingIndicator />
|
|
<TypingIndicator />
|
|
|
- ) : item.groupChatToken &&
|
|
|
|
|
- typingUsers[item.groupChatToken] &&
|
|
|
|
|
- (typingUsers[item.groupChatToken] as any)?.firstName ? (
|
|
|
|
|
- <TypingIndicator name={(typingUsers[item.groupChatToken] as any).firstName} />
|
|
|
|
|
|
|
+ ) : item.chat.groupChatToken &&
|
|
|
|
|
+ typingUsers[item.chat.groupChatToken] &&
|
|
|
|
|
+ (typingUsers[item.chat.groupChatToken] as any)?.firstName ? (
|
|
|
|
|
+ <TypingIndicator
|
|
|
|
|
+ name={(typingUsers[item.chat.groupChatToken] as any).firstName}
|
|
|
|
|
+ />
|
|
|
) : (
|
|
) : (
|
|
|
<Text numberOfLines={2} style={styles.chatMessage}>
|
|
<Text numberOfLines={2} style={styles.chatMessage}>
|
|
|
- {item.attachementName && item.attachementName.length
|
|
|
|
|
- ? item.attachementName
|
|
|
|
|
- : item.short}
|
|
|
|
|
|
|
+ {item.chat.attachementName && item.chat.attachementName.length
|
|
|
|
|
+ ? item.chat.attachementName
|
|
|
|
|
+ : highlightText(previewText, debouncedSearch, { backgroundColor: '#FFE58A' })}
|
|
|
</Text>
|
|
</Text>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
- {item.unreadCount > 0 ? (
|
|
|
|
|
|
|
+ {item.chat.unreadCount > 0 ? (
|
|
|
<View style={styles.unreadBadge}>
|
|
<View style={styles.unreadBadge}>
|
|
|
<Text style={styles.unreadText}>
|
|
<Text style={styles.unreadText}>
|
|
|
- {item.unreadCount > 99 ? '99+' : item.unreadCount}
|
|
|
|
|
|
|
+ {item.chat.unreadCount > 99 ? '99+' : item.chat.unreadCount}
|
|
|
</Text>
|
|
</Text>
|
|
|
</View>
|
|
</View>
|
|
|
) : null}
|
|
) : null}
|
|
@@ -544,7 +644,7 @@ const MessagesScreen = () => {
|
|
|
</View>
|
|
</View>
|
|
|
)}
|
|
)}
|
|
|
|
|
|
|
|
- {/* <View style={[{ paddingHorizontal: '4%' }]}>
|
|
|
|
|
|
|
+ <View style={[{ paddingHorizontal: '4%' }]}>
|
|
|
<Input
|
|
<Input
|
|
|
inputMode={'search'}
|
|
inputMode={'search'}
|
|
|
placeholder={'Search'}
|
|
placeholder={'Search'}
|
|
@@ -553,7 +653,7 @@ const MessagesScreen = () => {
|
|
|
icon={<SearchIcon fill={'#C8C8C8'} width={14} height={14} />}
|
|
icon={<SearchIcon fill={'#C8C8C8'} width={14} height={14} />}
|
|
|
height={38}
|
|
height={38}
|
|
|
/>
|
|
/>
|
|
|
- </View> */}
|
|
|
|
|
|
|
+ </View>
|
|
|
|
|
|
|
|
<HorizontalTabView
|
|
<HorizontalTabView
|
|
|
index={index}
|
|
index={index}
|
|
@@ -562,7 +662,7 @@ const MessagesScreen = () => {
|
|
|
sceneStyles={{ paddingHorizontal: 0 }}
|
|
sceneStyles={{ paddingHorizontal: 0 }}
|
|
|
maxTabHeight={50}
|
|
maxTabHeight={50}
|
|
|
renderScene={({ route }) => {
|
|
renderScene={({ route }) => {
|
|
|
- const data = route.key === routes[index].key ? filteredChatsForCurrentTab : [];
|
|
|
|
|
|
|
+ const data = route.key === routes[index].key ? searchedChats : [];
|
|
|
|
|
|
|
|
return route.key === 'blocked' ? (
|
|
return route.key === 'blocked' ? (
|
|
|
<FlashList
|
|
<FlashList
|
|
@@ -582,9 +682,9 @@ const MessagesScreen = () => {
|
|
|
itemVisiblePercentThreshold: 50,
|
|
itemVisiblePercentThreshold: 50,
|
|
|
minimumViewTime: 1000
|
|
minimumViewTime: 1000
|
|
|
}}
|
|
}}
|
|
|
- data={data as Chat[]}
|
|
|
|
|
|
|
+ data={data}
|
|
|
renderItem={renderChatItem}
|
|
renderItem={renderChatItem}
|
|
|
- keyExtractor={(item, i) => `${item.chatUid}-${item.groupChatToken}-${i}`}
|
|
|
|
|
|
|
+ keyExtractor={(item, i) => `${item.chat.chatUid}-${item.chat.groupChatToken}-${i}`}
|
|
|
extraData={typingUsers}
|
|
extraData={typingUsers}
|
|
|
/>
|
|
/>
|
|
|
);
|
|
);
|