update definitions

This commit is contained in:
Gerzon Z 2022-01-17 10:18:32 -04:00
parent e010d804d5
commit 18da04ba08
8 changed files with 17 additions and 30 deletions

View File

@ -41,25 +41,23 @@ const styles = StyleSheet.create({
interface IThreadDetails {
item: {
tcount: number | string;
tcount?: string | number;
replies?: any;
id: string;
};
user: {
id: string;
};
badgeColor: string;
badgeColor?: string;
toggleFollowThread: Function;
thread: boolean;
time: string;
style: ViewStyle;
}
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails) => {
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style }: IThreadDetails): JSX.Element => {
const { theme } = useTheme();
let { tcount } = item;
if (tcount >= 1000) {
if (tcount! >= 1000) {
tcount = '+999';
}

View File

@ -24,10 +24,8 @@ const Thread = React.memo(
item={{
tcount,
replies,
tlm,
id
}}
thread
user={user}
badgeColor={threadBadgeColor}
toggleFollowThread={toggleFollowThread}

View File

@ -61,10 +61,10 @@ export interface IThread {
reactions?: IReaction[];
role?: string;
drid?: string;
dcount?: number;
dcount?: number | string;
dlm?: number;
tmid?: string;
tcount?: number;
tcount?: number | string;
tlm?: Date;
replies?: string[];
mentions?: IUserMention[];

View File

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

View File

@ -53,6 +53,7 @@ export type ChatsStackParamList = {
rid: string;
room: ISubscription;
};
DiscussionsView: undefined;
SearchMessagesView: {
rid: string;
t: SubscriptionType;

View File

@ -80,10 +80,10 @@ const ChangePasscodeView = React.memo(() => {
return (
<Modal useNativeDriver isVisible={visible} hideModalContentWhileAnimating style={styles.modal}>
<PasscodeChoose theme={theme} finishProcess={onSubmit} force={data?.force} />
<PasscodeChoose theme={theme!} finishProcess={onSubmit} force={data?.force} />
{!data?.force ? (
<Touchable onPress={onCancel} style={styles.close}>
<CustomIcon name='close' color={themes[theme].passcodePrimary} size={30} />
<CustomIcon name='close' color={themes[theme!].passcodePrimary} size={30} />
</Touchable>
) : null}
</Modal>

View File

@ -1,6 +1,7 @@
import React from 'react';
import { StyleSheet, Text, View, ViewStyle } from 'react-native';
import { TThreadModel } from '../../definitions/IThread';
import { CustomIcon } from '../../lib/Icons';
import { themes } from '../../constants/colors';
import sharedStyles from '../Styles';
@ -29,11 +30,7 @@ const styles = StyleSheet.create({
});
interface IDiscussionDetails {
item: {
dcount: number | string;
replies?: any;
id: string;
};
item: TThreadModel;
user: {
id: string;
};
@ -45,7 +42,7 @@ const DiscussionDetails = ({ item, time, style }: IDiscussionDetails) => {
const { theme } = useTheme();
let { dcount } = item;
if (dcount >= 1000) {
if (dcount! >= 1000) {
dcount = '+999';
}

View File

@ -9,6 +9,7 @@ import { themes } from '../../constants/colors';
import Markdown from '../../containers/markdown';
import { formatDateThreads, makeThreadName } from '../../utils/room';
import DiscussionDetails from './DiscussionDetails';
import { TThreadModel } from '../../definitions/IThread';
const styles = StyleSheet.create({
container: {
@ -49,16 +50,7 @@ const styles = StyleSheet.create({
});
interface IItem {
item: {
id: string;
u: {
username: string;
};
dcount: string | number;
replies?: any;
msg: string;
ts: string;
};
item: TThreadModel;
baseUrl: string;
user: {
id: string;
@ -92,9 +84,9 @@ const Item = ({ item, baseUrl, user, onPress }: IItem): JSX.Element => {
<View style={styles.messageContainer}>
{/* @ts-ignore */}
<Markdown
msg={makeThreadName(item)}
msg={makeThreadName(item)!}
baseUrl={baseUrl}
username={username}
username={username!}
theme={theme!}
numberOfLines={2}
style={[styles.markdown]}