Minor tweak

This commit is contained in:
Gerzon Z 2021-09-01 13:15:15 -04:00
parent 618eb53932
commit 2d89d07e21
1 changed files with 6 additions and 5 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable react/prop-types */
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { FlatList } from 'react-native';
@ -29,6 +30,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
const canAutoTranslate = route.params?.canAutoTranslate;
const autoTranslate = route.params?.autoTranslate;
const autoTranslateLanguage = route.params?.autoTranslateLanguage;
const user = useSelector(state => state.login?.user);
const baseUrl = useSelector(state => state.server.server);
const useRealName = useSelector(state => state.settings.UI_Use_Real_Name);
const Message_TimeFormat = useSelector(state => state.settings.Message_TimeFormat);
@ -69,7 +71,8 @@ const DiscussionMessagesView = ({ navigation, route }) => {
];
if (text?.trim()) {
whereClause.push(Q.where('msg', Q.like(`%${ sanitizeLikeString(text?.trim()) }%`)));
whereClause.push(Q.where('msg', Q.like(`%${ sanitizeLikeString(text?.trim()) }%`)),
Q.where('username', Q.like(`%${ sanitizeLikeString(text?.trim()) }%`)));
}
const discussionsMessages = await db
@ -156,13 +159,12 @@ const DiscussionMessagesView = ({ navigation, route }) => {
});
}, 1000, true);
// eslint-disable-next-line react/prop-types
const renderItem = ({ item }) => (
<Message
item={item}
// eslint-disable-next-line react/prop-types
user={item.id}
user={user}
rid={rid}
navToRoomInfo={() => {}}
onDiscussionPress={onDiscussionPress}
baseUrl={baseUrl}
timeFormat={Message_TimeFormat}
@ -186,7 +188,6 @@ const DiscussionMessagesView = ({ navigation, route }) => {
<FlatList
data={discussions}
renderItem={renderItem}
// eslint-disable-next-line react/prop-types
keyExtractor={item => item.msg}
style={{ backgroundColor: themes[theme].backgroundColor }}
onEndReachedThreshold={0.5}