diff --git a/app/containers/SearchHeader.tsx b/app/containers/SearchHeader.tsx index 7668a0db0..f79451355 100644 --- a/app/containers/SearchHeader.tsx +++ b/app/containers/SearchHeader.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; +import I18n from '../i18n'; import { useTheme } from '../theme'; import sharedStyles from '../views/Styles'; import { themes } from '../constants/colors'; @@ -21,11 +22,10 @@ const styles = StyleSheet.create({ interface ISearchHeaderProps { onSearchChangeText?: (text: string) => void; - placeholder: string; testID: string; } -const SearchHeader = ({ onSearchChangeText, placeholder, testID }: ISearchHeaderProps) => { +const SearchHeader = ({ onSearchChangeText, testID }: ISearchHeaderProps): JSX.Element => { const { theme } = useTheme(); const isLight = theme === 'light'; const { isLandscape } = useOrientation(); @@ -37,7 +37,7 @@ const SearchHeader = ({ onSearchChangeText, placeholder, testID }: ISearchHeader { ); } - const { onPress, onLongPress, onDiscussionPress } = useContext(MessageContext); + const { onPress, onLongPress } = useContext(MessageContext); return ( (props.type === 'discussion-created' ? onDiscussionPress() : onPress())} + onPress={onPress} disabled={(props.isInfo && !props.isThreadReply) || props.archived || props.isTemp} style={{ backgroundColor: props.highlighted ? themes[props.theme].headerBackground : null }}> diff --git a/app/containers/message/index.tsx b/app/containers/message/index.tsx index ad86975e7..75458b470 100644 --- a/app/containers/message/index.tsx +++ b/app/containers/message/index.tsx @@ -147,6 +147,12 @@ class MessageContainer extends React.Component { if ((item.tlm || item.tmid) && !isThreadRoom) { this.onThreadPress(); } + + const { onDiscussionPress } = this.props; + + if (onDiscussionPress) { + onDiscussionPress(item); + } }, 300, true diff --git a/app/views/DiscussionsView/DiscussionDetails.tsx b/app/views/DiscussionsView/DiscussionDetails.tsx index 86b055c2b..5edca01d1 100644 --- a/app/views/DiscussionsView/DiscussionDetails.tsx +++ b/app/views/DiscussionsView/DiscussionDetails.tsx @@ -34,11 +34,11 @@ interface IDiscussionDetails { user: { id: string; }; - time: string; + date: string; style: ViewStyle; } -const DiscussionDetails = ({ item, time, style }: IDiscussionDetails) => { +const DiscussionDetails = ({ item, date, style }: IDiscussionDetails) => { const { theme } = useTheme(); let { dcount } = item; @@ -59,7 +59,7 @@ const DiscussionDetails = ({ item, time, style }: IDiscussionDetails) => { - {time} + {date} diff --git a/app/views/DiscussionsView/Item.tsx b/app/views/DiscussionsView/Item.tsx index 51f26a1ca..379bea085 100644 --- a/app/views/DiscussionsView/Item.tsx +++ b/app/views/DiscussionsView/Item.tsx @@ -89,18 +89,20 @@ const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => { {messageTime!} - {/* @ts-ignore */} - + {makeThreadName(item) && item && username ? ( + /* @ts-ignore */ + + ) : null} - + diff --git a/app/views/DiscussionsView/index.tsx b/app/views/DiscussionsView/index.tsx index 65b5c0876..85ba37032 100644 --- a/app/views/DiscussionsView/index.tsx +++ b/app/views/DiscussionsView/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useLayoutEffect, useState } from 'react'; import { FlatList } from 'react-native'; import { useSelector } from 'react-redux'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; @@ -127,11 +127,7 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem ), headerTitle: () => ( - + ), headerTitleContainerStyle: { left: headerTitlePosition.left, @@ -169,7 +165,7 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem load(); }, []); - useEffect(() => { + useLayoutEffect(() => { const options = setHeader(); navigation.setOptions(options); }, [navigation, isSearching]); @@ -192,7 +188,6 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem {...{ item, user, - navigation, baseUrl }} onPress={onDiscussionPress} @@ -213,9 +208,6 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem style={{ backgroundColor: themes[theme!].backgroundColor }} contentContainerStyle={styles.contentContainer} onEndReachedThreshold={0.5} - maxToRenderPerBatch={5} - windowSize={10} - initialNumToRender={7} removeClippedSubviews={isIOS} onEndReached={() => (searchTotal || total) > API_FETCH_COUNT ?? load()} ItemSeparatorComponent={List.Separator} diff --git a/app/views/TeamChannelsView.tsx b/app/views/TeamChannelsView.tsx index 581f2baca..efacb1fe1 100644 --- a/app/views/TeamChannelsView.tsx +++ b/app/views/TeamChannelsView.tsx @@ -218,11 +218,7 @@ class TeamChannelsView extends React.Component ), headerTitle: () => ( - + ), headerTitleContainerStyle: { left: headerTitlePosition.left, diff --git a/app/views/ThreadMessagesView/index.tsx b/app/views/ThreadMessagesView/index.tsx index bce1f7c8b..af688ac3e 100644 --- a/app/views/ThreadMessagesView/index.tsx +++ b/app/views/ThreadMessagesView/index.tsx @@ -145,11 +145,7 @@ class ThreadMessagesView extends React.Component ), headerTitle: () => ( - + ), headerTitleContainerStyle: { left: headerTitlePosition.left,