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 React from 'react';
import { StyleSheet, View } from 'react-native'; import { StyleSheet, View } from 'react-native';
import { useOrientation } from '../dimensions'; import { useTheme } from '../theme';
import { isIOS, isTablet } from '../utils/deviceInfo';
import { themes } from '../constants/colors';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { themes } from '../constants/colors';
import TextInput from '../presentation/TextInput'; import TextInput from '../presentation/TextInput';
import { isIOS, isTablet } from '../utils/deviceInfo';
import { useOrientation } from '../dimensions';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -21,11 +22,11 @@ const styles = StyleSheet.create({
interface ISearchHeaderProps { interface ISearchHeaderProps {
onSearchChangeText?: (text: string) => void; onSearchChangeText?: (text: string) => void;
placeholder: string; placeholder: string;
theme: string;
testID: string; testID: string;
} }
const SearchHeader = ({ onSearchChangeText, placeholder, theme, testID }: ISearchHeaderProps) => { const SearchHeader = ({ onSearchChangeText, placeholder, testID }: ISearchHeaderProps) => {
const { theme } = useTheme();
const isLight = theme === 'light'; const isLight = theme === 'light';
const { isLandscape } = useOrientation(); const { isLandscape } = useOrientation();
const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1; const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1;

View File

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

View File

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

View File

@ -66,8 +66,13 @@ interface IItem {
const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => { const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => {
const { theme } = useTheme(); const { theme } = useTheme();
const username = item?.u?.username; const username = item?.u?.username;
const messageTime = moment(item.ts).format('LT'); let messageTime;
const messageDate = formatDateThreads(item.ts); let messageDate;
if (item?.ts) {
messageTime = moment(item.ts).format('LT');
messageDate = formatDateThreads(item.ts);
}
return ( return (
<Touchable <Touchable

View File

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

View File

@ -2,7 +2,7 @@ import React from 'react';
import { StyleSheet, Text, View } from 'react-native'; import { StyleSheet, Text, View } from 'react-native';
import Touchable from 'react-native-platform-touchable'; import Touchable from 'react-native-platform-touchable';
import { useTheme, withTheme } from '../../theme'; import { useTheme } from '../../theme';
import Avatar from '../../containers/Avatar'; import Avatar from '../../containers/Avatar';
import sharedStyles from '../Styles'; import sharedStyles from '../Styles';
import { themes } from '../../constants/colors'; import { themes } from '../../constants/colors';
@ -69,7 +69,10 @@ interface IItem {
const Item = ({ item, baseUrl, useRealName, user, badgeColor, onPress, toggleFollowThread }: IItem) => { const Item = ({ item, baseUrl, useRealName, user, badgeColor, onPress, toggleFollowThread }: IItem) => {
const { theme } = useTheme(); const { theme } = useTheme();
const username = (useRealName && item?.u?.name) || item?.u?.username; const username = (useRealName && item?.u?.name) || item?.u?.username;
const time = formatDateThreads(item.ts!); let time;
if (item?.ts) {
time = formatDateThreads(item.ts);
}
return ( return (
<Touchable <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 <SearchHeader
onSearchChangeText={this.onSearchChangeText} onSearchChangeText={this.onSearchChangeText}
placeholder='Search' placeholder='Search'
theme={theme}
testID='thread-messages-view-search-header' testID='thread-messages-view-search-header'
/> />
), ),
@ -558,8 +557,7 @@ const mapStateToProps = (state: any) => ({
baseUrl: state.server.server, baseUrl: state.server.server,
user: getUserSelector(state), user: getUserSelector(state),
useRealName: state.settings.UI_Use_Real_Name, useRealName: state.settings.UI_Use_Real_Name,
isMasterDetail: state.app.isMasterDetail, isMasterDetail: state.app.isMasterDetail
Message_TimeFormat: state.settings.Message_TimeFormat
}); });
export default connect(mapStateToProps)(withTheme(withSafeAreaInsets(ThreadMessagesView))); export default connect(mapStateToProps)(withTheme(withSafeAreaInsets(ThreadMessagesView)));