Minor tweaks

This commit is contained in:
Gerzon Z 2022-01-17 16:15:58 -04:00
parent 680476a9a7
commit 6c9a3f977e
7 changed files with 24 additions and 16 deletions

View File

@ -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;

View File

@ -65,7 +65,7 @@ export interface IThread {
dlm?: number;
tmid?: string;
tcount?: number | string;
tlm?: Date;
tlm?: string;
replies?: string[];
mentions?: IUserMention[];
channels?: IUserChannel[];

View File

@ -56,7 +56,9 @@ export type ModalStackParamList = {
rid: string;
room: ISubscription;
};
DiscussionsView: undefined;
DiscussionsView: {
rid: string;
};
SearchMessagesView: {
rid: string;
t: SubscriptionType;

View File

@ -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 (
<Touchable

View File

@ -221,7 +221,6 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
<SearchHeader
onSearchChangeText={this.onSearchChangeText}
placeholder='Search Channels'
theme={theme}
testID='team-channels-view-search-header'
/>
),

View File

@ -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 (
<Touchable
@ -105,4 +108,4 @@ const Item = ({ item, baseUrl, useRealName, user, badgeColor, onPress, toggleFol
);
};
export default withTheme(Item);
export default Item;

View File

@ -148,7 +148,6 @@ class ThreadMessagesView extends React.Component<IThreadMessagesViewProps, IThre
<SearchHeader
onSearchChangeText={this.onSearchChangeText}
placeholder='Search'
theme={theme}
testID='thread-messages-view-search-header'
/>
),
@ -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)));