import React, { useContext, useMemo, useRef } from 'react'; import { FlatList, StyleSheet, Text, View } from 'react-native'; import { AtMentions, useTheme } from 'stream-chat-react-native'; import { MessageResponse } from 'stream-chat'; import { ChatScreenHeader } from '../components/ChatScreenHeader'; import { MessageSearchList } from '../components/MessageSearch/MessageSearchList'; import { usePaginatedSearchedMessages } from '../hooks/usePaginatedSearchedMessages'; import { useScrollToTop } from '@react-navigation/native'; import type { StackNavigationProp } from '@react-navigation/stack'; import type { BottomTabNavigatorParamList } from '../types'; import { AppContext } from '../context/AppContext'; import type { LocalAttachmentType, LocalChannelType, LocalCommandType, LocalMessageType, LocalReactionType, LocalUserType, } from '../types'; const styles = StyleSheet.create({ container: { flex: 1, }, emptyIndicatorContainer: { alignItems: 'center', flex: 1, justifyContent: 'center', }, emptyIndicatorText: { fontSize: 14, paddingTop: 28, }, }); const EmptyMentionsSearchIndicator = () => { const { theme: { colors: { grey, grey_gainsboro }, }, } = useTheme(); return ( No mentions exist yet... ); }; export type MentionsScreenProps = { navigation: StackNavigationProp; }; export const MentionsScreen: React.FC = () => { const { theme: { colors: { white_snow }, }, } = useTheme(); const { chatClient } = useContext(AppContext); const messageFilters = useMemo( () => ({ 'mentioned_users.id': { $contains: chatClient?.user?.id || '', }, }), [chatClient], ); const scrollRef = useRef > | null>(null); useScrollToTop(scrollRef); const { loading, loadMore, messages, refreshing, refreshList } = usePaginatedSearchedMessages(messageFilters); return ( ); };