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