diff --git a/app/containers/SearchHeader.tsx b/app/containers/SearchHeader.tsx index 64d79980a..7668a0db0 100644 --- a/app/containers/SearchHeader.tsx +++ b/app/containers/SearchHeader.tsx @@ -1,11 +1,12 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; -import { useOrientation } from '../dimensions'; -import { isIOS, isTablet } from '../utils/deviceInfo'; -import { themes } from '../constants/colors'; +import { useTheme } from '../theme'; import sharedStyles from '../views/Styles'; +import { themes } from '../constants/colors'; import TextInput from '../presentation/TextInput'; +import { isIOS, isTablet } from '../utils/deviceInfo'; +import { useOrientation } from '../dimensions'; const styles = StyleSheet.create({ container: { @@ -21,11 +22,11 @@ const styles = StyleSheet.create({ interface ISearchHeaderProps { onSearchChangeText?: (text: string) => void; placeholder: string; - theme: string; testID: string; } -const SearchHeader = ({ onSearchChangeText, placeholder, theme, testID }: ISearchHeaderProps) => { +const SearchHeader = ({ onSearchChangeText, placeholder, testID }: ISearchHeaderProps) => { + const { theme } = useTheme(); const isLight = theme === 'light'; const { isLandscape } = useOrientation(); const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1; diff --git a/app/definitions/IThread.ts b/app/definitions/IThread.ts index 661c442eb..14926e891 100644 --- a/app/definitions/IThread.ts +++ b/app/definitions/IThread.ts @@ -65,7 +65,7 @@ export interface IThread { dlm?: number; tmid?: string; tcount?: number | string; - tlm?: Date; + tlm?: string; replies?: string[]; mentions?: IUserMention[]; channels?: IUserChannel[]; diff --git a/app/stacks/MasterDetailStack/types.ts b/app/stacks/MasterDetailStack/types.ts index 0e260c37d..3a05dca2a 100644 --- a/app/stacks/MasterDetailStack/types.ts +++ b/app/stacks/MasterDetailStack/types.ts @@ -56,7 +56,9 @@ export type ModalStackParamList = { rid: string; room: ISubscription; }; - DiscussionsView: undefined; + DiscussionsView: { + rid: string; + }; SearchMessagesView: { rid: string; t: SubscriptionType; diff --git a/app/views/DiscussionsView/Item.tsx b/app/views/DiscussionsView/Item.tsx index 4370042ed..c8ee5c8aa 100644 --- a/app/views/DiscussionsView/Item.tsx +++ b/app/views/DiscussionsView/Item.tsx @@ -66,8 +66,13 @@ interface IItem { const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => { const { theme } = useTheme(); const username = item?.u?.username; - const messageTime = moment(item.ts).format('LT'); - const messageDate = formatDateThreads(item.ts); + let messageTime; + let messageDate; + + if (item?.ts) { + messageTime = moment(item.ts).format('LT'); + messageDate = formatDateThreads(item.ts); + } return ( ), diff --git a/app/views/ThreadMessagesView/Item.tsx b/app/views/ThreadMessagesView/Item.tsx index 67f42ba6d..4d33ecea3 100644 --- a/app/views/ThreadMessagesView/Item.tsx +++ b/app/views/ThreadMessagesView/Item.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import Touchable from 'react-native-platform-touchable'; -import { useTheme, withTheme } from '../../theme'; +import { useTheme } from '../../theme'; import Avatar from '../../containers/Avatar'; import sharedStyles from '../Styles'; import { themes } from '../../constants/colors'; @@ -69,7 +69,10 @@ interface IItem { const Item = ({ item, baseUrl, useRealName, user, badgeColor, onPress, toggleFollowThread }: IItem) => { const { theme } = useTheme(); const username = (useRealName && item?.u?.name) || item?.u?.username; - const time = formatDateThreads(item.ts!); + let time; + if (item?.ts) { + time = formatDateThreads(item.ts); + } return ( ), @@ -558,8 +557,7 @@ const mapStateToProps = (state: any) => ({ baseUrl: state.server.server, user: getUserSelector(state), useRealName: state.settings.UI_Use_Real_Name, - isMasterDetail: state.app.isMasterDetail, - Message_TimeFormat: state.settings.Message_TimeFormat + isMasterDetail: state.app.isMasterDetail }); export default connect(mapStateToProps)(withTheme(withSafeAreaInsets(ThreadMessagesView)));