diff --git a/app/AppContainer.tsx b/app/AppContainer.tsx
index b73aaf8e..441220fe 100644
--- a/app/AppContainer.tsx
+++ b/app/AppContainer.tsx
@@ -3,7 +3,7 @@ import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { connect } from 'react-redux';
-import { SetUsernameStackParamList, StackParamList } from './navigationTypes';
+import { SetUsernameStackParamList, StackParamList } from './definitions/navigationTypes';
import Navigation from './lib/Navigation';
import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation';
import { ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app';
diff --git a/app/containers/BackgroundContainer/index.tsx b/app/containers/BackgroundContainer/index.tsx
index fbe5d307..fc26fe0a 100644
--- a/app/containers/BackgroundContainer/index.tsx
+++ b/app/containers/BackgroundContainer/index.tsx
@@ -6,9 +6,9 @@ import sharedStyles from '../../views/Styles';
import { themes } from '../../constants/colors';
interface IBackgroundContainer {
- text: string;
- theme: string;
- loading: boolean;
+ text?: string;
+ theme?: string;
+ loading?: boolean;
}
const styles = StyleSheet.create({
@@ -35,8 +35,8 @@ const styles = StyleSheet.create({
const BackgroundContainer = ({ theme, text, loading }: IBackgroundContainer) => (
- {text ? {text} : null}
- {loading ? : null}
+ {text ? {text} : null}
+ {loading ? : null}
);
diff --git a/app/containers/HeaderButton/Common.tsx b/app/containers/HeaderButton/Common.tsx
index b40543dd..0877fb4c 100644
--- a/app/containers/HeaderButton/Common.tsx
+++ b/app/containers/HeaderButton/Common.tsx
@@ -29,9 +29,9 @@ export const CloseModal = React.memo(
export const CancelModal = React.memo(({ onPress, testID }: Partial) => (
{isIOS ? (
-
+
) : (
-
+
)}
));
@@ -39,19 +39,19 @@ export const CancelModal = React.memo(({ onPress, testID }: Partial) => (
-
+
));
export const Download = React.memo(({ onPress, testID, ...props }: Partial) => (
-
+
));
export const Preferences = React.memo(({ onPress, testID, ...props }: Partial) => (
-
+
));
diff --git a/app/containers/HeaderButton/HeaderButtonItem.tsx b/app/containers/HeaderButton/HeaderButtonItem.tsx
index b350232d..08f6b5a3 100644
--- a/app/containers/HeaderButton/HeaderButtonItem.tsx
+++ b/app/containers/HeaderButton/HeaderButtonItem.tsx
@@ -8,12 +8,12 @@ import { themes } from '../../constants/colors';
import sharedStyles from '../../views/Styles';
interface IHeaderButtonItem {
- title: string;
- iconName: string;
- onPress(): void;
- testID: string;
- theme: string;
- badge(): void;
+ title?: string;
+ iconName?: string;
+ onPress: (arg: T) => void;
+ testID?: string;
+ theme?: string;
+ badge?(): void;
}
export const BUTTON_HIT_SLOP = {
@@ -44,9 +44,9 @@ const Item = ({ title, iconName, onPress, testID, theme, badge }: IHeaderButtonI
<>
{iconName ? (
-
+
) : (
- {title}
+ {title}
)}
{badge ? badge() : null}
>
diff --git a/app/containers/List/ListContainer.tsx b/app/containers/List/ListContainer.tsx
index 408310d9..deb9c8a7 100644
--- a/app/containers/List/ListContainer.tsx
+++ b/app/containers/List/ListContainer.tsx
@@ -11,10 +11,10 @@ const styles = StyleSheet.create({
});
interface IListContainer {
- children: JSX.Element;
+ children: React.ReactNode;
+ testID?: string;
}
const ListContainer = React.memo(({ children, ...props }: IListContainer) => (
- // @ts-ignore
(
-
+
{translateTitle ? I18n.t(title) : title}
diff --git a/app/containers/List/ListIcon.tsx b/app/containers/List/ListIcon.tsx
index 7d569dce..71e4fbdf 100644
--- a/app/containers/List/ListIcon.tsx
+++ b/app/containers/List/ListIcon.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { StyleSheet, View } from 'react-native';
+import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
import { themes } from '../../constants/colors';
import { CustomIcon } from '../../lib/Icons';
@@ -7,11 +7,11 @@ import { withTheme } from '../../theme';
import { ICON_SIZE } from './constants';
interface IListIcon {
- theme: string;
+ theme?: string;
name: string;
- color: string;
- style: object;
- testID: string;
+ color?: string;
+ style?: StyleProp;
+ testID?: string;
}
const styles = StyleSheet.create({
@@ -23,7 +23,7 @@ const styles = StyleSheet.create({
const ListIcon = React.memo(({ theme, name, color, style, testID }: IListIcon) => (
-
+
));
diff --git a/app/containers/List/ListInfo.tsx b/app/containers/List/ListInfo.tsx
index bc4f02e3..2bfe68e3 100644
--- a/app/containers/List/ListInfo.tsx
+++ b/app/containers/List/ListInfo.tsx
@@ -20,13 +20,13 @@ const styles = StyleSheet.create({
interface IListHeader {
info: string;
- theme: string;
- translateInfo: boolean;
+ theme?: string;
+ translateInfo?: boolean;
}
const ListInfo = React.memo(({ info, theme, translateInfo = true }: IListHeader) => (
- {translateInfo ? I18n.t(info) : info}
+ {translateInfo ? I18n.t(info) : info}
));
diff --git a/app/containers/List/ListItem.tsx b/app/containers/List/ListItem.tsx
index a05eaf9a..87abfd2d 100644
--- a/app/containers/List/ListItem.tsx
+++ b/app/containers/List/ListItem.tsx
@@ -56,11 +56,11 @@ const styles = StyleSheet.create({
interface IListItemContent {
title?: string;
subtitle?: string;
- left?: Function;
- right?: Function;
+ left?: () => JSX.Element | null;
+ right?: () => JSX.Element | null;
disabled?: boolean;
testID?: string;
- theme: string;
+ theme?: string;
color?: string;
translateTitle?: boolean;
translateSubtitle?: boolean;
@@ -89,15 +89,15 @@ const Content = React.memo(
{left ? {left()} : null}
-
+
{translateTitle ? I18n.t(title) : title}
{alert ? (
-
+
) : null}
{subtitle ? (
-
+
{translateSubtitle ? I18n.t(subtitle) : subtitle}
) : null}
@@ -112,38 +112,39 @@ const Content = React.memo(
)
);
-interface IListItemButton {
+interface IListButtonPress {
+ onPress?: Function;
+}
+
+interface IListItemButton extends IListButtonPress {
title?: string;
- onPress: Function;
disabled?: boolean;
- theme: string;
- backgroundColor: string;
+ theme?: string;
+ backgroundColor?: string;
underlayColor?: string;
}
-const Button = React.memo(({ onPress, backgroundColor, underlayColor, ...props }: IListItemButton) => (
+const Button = React.memo(({ onPress, backgroundColor, underlayColor, ...props }: IListItemButton) => (
onPress(props.title)}
- style={{ backgroundColor: backgroundColor || themes[props.theme].backgroundColor }}
+ onPress={() => onPress!(props.title)}
+ style={{ backgroundColor: backgroundColor || themes[props.theme!].backgroundColor }}
underlayColor={underlayColor}
enabled={!props.disabled}
- theme={props.theme}>
+ theme={props.theme!}>
));
-interface IListItem {
- onPress: Function;
- theme: string;
- backgroundColor: string;
+interface IListItem extends IListItemContent, IListButtonPress {
+ backgroundColor?: string;
}
-const ListItem = React.memo(({ ...props }: IListItem) => {
+const ListItem = React.memo(({ ...props }: IListItem) => {
if (props.onPress) {
return ;
}
return (
-
+
);
diff --git a/app/containers/List/ListSection.tsx b/app/containers/List/ListSection.tsx
index 7607ad12..e334f5f3 100644
--- a/app/containers/List/ListSection.tsx
+++ b/app/containers/List/ListSection.tsx
@@ -11,9 +11,9 @@ const styles = StyleSheet.create({
});
interface IListSection {
- children: JSX.Element;
- title: string;
- translateTitle: boolean;
+ children: React.ReactNode;
+ title?: string;
+ translateTitle?: boolean;
}
const ListSection = React.memo(({ children, title, translateTitle }: IListSection) => (
diff --git a/app/containers/List/ListSeparator.tsx b/app/containers/List/ListSeparator.tsx
index 6a78ef65..db34b05b 100644
--- a/app/containers/List/ListSeparator.tsx
+++ b/app/containers/List/ListSeparator.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { StyleSheet, View } from 'react-native';
+import { StyleSheet, View, ViewStyle } from 'react-native';
import { themes } from '../../constants/colors';
import { withTheme } from '../../theme';
@@ -11,12 +11,12 @@ const styles = StyleSheet.create({
});
interface IListSeparator {
- style: object;
- theme: string;
+ style?: ViewStyle;
+ theme?: string;
}
const ListSeparator = React.memo(({ style, theme }: IListSeparator) => (
-
+
));
ListSeparator.displayName = 'List.Separator';
diff --git a/app/containers/Loading.tsx b/app/containers/Loading.tsx
index 6bcc3baa..cd4ed285 100644
--- a/app/containers/Loading.tsx
+++ b/app/containers/Loading.tsx
@@ -19,7 +19,7 @@ const styles = StyleSheet.create({
interface ILoadingProps {
visible: boolean;
- theme: string;
+ theme?: string;
}
class Loading extends React.PureComponent {
@@ -97,7 +97,7 @@ class Loading extends React.PureComponent {
const opacityAnimation = opacity.interpolate({
inputRange: [0, 1],
- outputRange: [0, themes[theme].backdropOpacity],
+ outputRange: [0, themes[theme!].backdropOpacity],
extrapolate: 'clamp'
});
@@ -109,7 +109,7 @@ class Loading extends React.PureComponent {
{
// @ts-ignore
...StyleSheet.absoluteFill,
- backgroundColor: themes[theme].backdropColor,
+ backgroundColor: themes[theme!].backdropColor,
opacity: opacityAnimation
}
]}
diff --git a/app/containers/MessageActions/Header.tsx b/app/containers/MessageActions/Header.tsx
index d3556ccb..ace8d56b 100644
--- a/app/containers/MessageActions/Header.tsx
+++ b/app/containers/MessageActions/Header.tsx
@@ -17,7 +17,7 @@ interface IHeader {
server: string;
message: object;
isMasterDetail: boolean;
- theme: string;
+ theme?: string;
}
interface THeaderItem {
@@ -117,19 +117,19 @@ const Header = React.memo(({ handleReaction, server, message, isMasterDetail, th
const onReaction = ({ emoji }: { emoji: IEmoji }) => handleReaction(emoji, message);
const renderItem = useCallback(
- ({ item }) => ,
+ ({ item }) => ,
[]
);
- const renderFooter = useCallback(() => , []);
+ const renderFooter = useCallback(() => , []);
return (
-
+
{
@@ -37,7 +37,7 @@ const Item = ({ item, theme }: IMessageBoxCommandsPreviewItem) => {
{loading ? : null}
) : (
-
+
)}
);
diff --git a/app/containers/MessageBox/CommandsPreview/index.tsx b/app/containers/MessageBox/CommandsPreview/index.tsx
index 3820f6fa..c5434f66 100644
--- a/app/containers/MessageBox/CommandsPreview/index.tsx
+++ b/app/containers/MessageBox/CommandsPreview/index.tsx
@@ -10,7 +10,7 @@ import { withTheme } from '../../../theme';
interface IMessageBoxCommandsPreview {
commandPreview: [];
showCommandPreview: boolean;
- theme: string;
+ theme?: string;
}
const CommandsPreview = React.memo(
@@ -21,7 +21,7 @@ const CommandsPreview = React.memo(
return (
}
keyExtractor={(item: any) => item.id}
diff --git a/app/containers/MessageBox/index.tsx b/app/containers/MessageBox/index.tsx
index 9fe3d11a..fbcf24cd 100644
--- a/app/containers/MessageBox/index.tsx
+++ b/app/containers/MessageBox/index.tsx
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Alert, Keyboard, NativeModules, Text, View } from 'react-native';
import { connect } from 'react-redux';
import { KeyboardAccessoryView } from 'react-native-ui-lib/keyboard';
-import ImagePicker from 'react-native-image-crop-picker';
+import ImagePicker, { Image, ImageOrVideo } from 'react-native-image-crop-picker';
import { dequal } from 'dequal';
import DocumentPicker from 'react-native-document-picker';
import { Q } from '@nozbe/watermelondb';
@@ -27,7 +27,7 @@ import LeftButtons from './LeftButtons';
// @ts-ignore
// eslint-disable-next-line import/extensions,import/no-unresolved
import RightButtons from './RightButtons';
-import { isAndroid, isTablet } from '../../utils/deviceInfo';
+import { isAndroid, isIOS, isTablet } from '../../utils/deviceInfo';
import { canUploadFile } from '../../utils/media';
import EventEmiter from '../../utils/events';
import { KEY_COMMAND, handleCommandShowUpload, handleCommandSubmit, handleCommandTyping } from '../../commands';
@@ -54,15 +54,16 @@ if (isAndroid) {
const imagePickerConfig = {
cropping: true,
- compressImageQuality: 0.8,
avoidEmptySpaceAroundImage: false,
- freeStyleCropEnabled: true
+ freeStyleCropEnabled: true,
+ forceJpg: true
};
const libraryPickerConfig = {
multiple: true,
compressVideoPreset: 'Passthrough',
- mediaType: 'any'
+ mediaType: 'any',
+ forceJpg: true
};
const videoPickerConfig = {
@@ -129,6 +130,18 @@ interface IMessageBoxState {
permissionToUpload: boolean;
}
+const forceJpgExtension = (attachment: ImageOrVideo) => {
+ if (isIOS && attachment.mime === 'image/jpeg' && attachment.filename) {
+ const regex = new RegExp(/.heic$/i);
+ if (attachment.filename.match(regex)) {
+ attachment.filename = attachment.filename.replace(regex, '.jpg');
+ } else {
+ attachment.filename += '.jpg';
+ }
+ }
+ return attachment;
+};
+
class MessageBox extends Component {
private text: string;
@@ -692,7 +705,8 @@ class MessageBox extends Component {
takePhoto = async () => {
logEvent(events.ROOM_BOX_ACTION_PHOTO);
try {
- const image = await ImagePicker.openCamera(this.imagePickerConfig);
+ let image = (await ImagePicker.openCamera(this.imagePickerConfig)) as Image;
+ image = forceJpgExtension(image);
if (this.canUploadFile(image)) {
this.openShareView([image]);
}
@@ -716,7 +730,8 @@ class MessageBox extends Component {
chooseFromLibrary = async () => {
logEvent(events.ROOM_BOX_ACTION_LIBRARY);
try {
- const attachments = await ImagePicker.openPicker(this.libraryPickerConfig);
+ let attachments = (await ImagePicker.openPicker(this.libraryPickerConfig)) as ImageOrVideo[];
+ attachments = attachments.map(att => forceJpgExtension(att));
this.openShareView(attachments);
} catch (e) {
logEvent(events.ROOM_BOX_ACTION_LIBRARY_F);
diff --git a/app/containers/RoomHeader/RoomHeader.tsx b/app/containers/RoomHeader/RoomHeader.tsx
index 0ca3bbf5..719725fe 100644
--- a/app/containers/RoomHeader/RoomHeader.tsx
+++ b/app/containers/RoomHeader/RoomHeader.tsx
@@ -68,11 +68,11 @@ interface IRoomHeader {
tmid: string;
teamMain: boolean;
status: string;
- theme: string;
+ theme?: string;
usersTyping: [];
isGroupChat: boolean;
parentTitle: string;
- onPress: Function;
+ onPress: () => void;
testID: string;
}
@@ -164,7 +164,7 @@ const Header = React.memo(
renderFunc = () => (
-
+
{parentTitle}
@@ -186,9 +186,15 @@ const Header = React.memo(
{tmid ? null : (
)}
-
+
-
+
);
}
diff --git a/app/containers/RoomHeader/index.tsx b/app/containers/RoomHeader/index.tsx
index 5b06fb89..fb00bc10 100644
--- a/app/containers/RoomHeader/index.tsx
+++ b/app/containers/RoomHeader/index.tsx
@@ -13,7 +13,7 @@ interface IRoomHeaderContainerProps {
prid: string;
tmid: string;
teamMain: boolean;
- usersTyping: string;
+ usersTyping: [];
status: string;
statusText: string;
connecting: boolean;
@@ -79,14 +79,12 @@ class RoomHeaderContainer extends Component {
teamMain,
prid,
tmid,
- widthOffset,
status = 'offline',
statusText,
connecting,
connected,
usersTyping,
onPress,
- roomUserId,
width,
height,
parentTitle,
@@ -115,9 +113,6 @@ class RoomHeaderContainer extends Component {
width={width}
height={height}
usersTyping={usersTyping}
- widthOffset={widthOffset}
- roomUserId={roomUserId}
- connecting={connecting}
parentTitle={parentTitle}
isGroupChat={isGroupChat}
testID={testID}
diff --git a/app/containers/RoomTypeIcon.tsx b/app/containers/RoomTypeIcon.tsx
index b4ac871e..a157f53b 100644
--- a/app/containers/RoomTypeIcon.tsx
+++ b/app/containers/RoomTypeIcon.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { StyleSheet } from 'react-native';
+import { StyleSheet, ViewStyle } from 'react-native';
import { CustomIcon } from '../lib/Icons';
import { STATUS_COLORS, themes } from '../constants/colors';
@@ -13,13 +13,13 @@ const styles = StyleSheet.create({
});
interface IRoomTypeIcon {
- theme: string;
+ theme?: string;
type: string;
- isGroupChat: boolean;
- teamMain: boolean;
- status: string;
- size: number;
- style: any;
+ isGroupChat?: boolean;
+ teamMain?: boolean;
+ status?: string;
+ size?: number;
+ style?: ViewStyle;
}
const RoomTypeIcon = React.memo(({ type, isGroupChat, status, style, theme, teamMain, size = 16 }: IRoomTypeIcon) => {
@@ -27,11 +27,13 @@ const RoomTypeIcon = React.memo(({ type, isGroupChat, status, style, theme, team
return null;
}
- const color = themes[theme].titleText;
+ const color = themes[theme!].titleText;
const iconStyle = [styles.icon, { color }, style];
if (type === 'd' && !isGroupChat) {
- return ;
+ return (
+
+ );
}
// TODO: move this to a separate function
diff --git a/app/containers/SafeAreaView.tsx b/app/containers/SafeAreaView.tsx
index 7daa3347..3794fdb9 100644
--- a/app/containers/SafeAreaView.tsx
+++ b/app/containers/SafeAreaView.tsx
@@ -12,16 +12,16 @@ const styles = StyleSheet.create({
});
interface ISafeAreaView {
- testID: string;
- theme: string;
- vertical: boolean;
- style: object;
- children: JSX.Element;
+ testID?: string;
+ theme?: string;
+ vertical?: boolean;
+ style?: object;
+ children: React.ReactNode;
}
const SafeAreaView = React.memo(({ style, children, testID, theme, vertical = true, ...props }: ISafeAreaView) => (
diff --git a/app/containers/SearchBox.tsx b/app/containers/SearchBox.tsx
index 6668e0f7..9ab236eb 100644
--- a/app/containers/SearchBox.tsx
+++ b/app/containers/SearchBox.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { StyleSheet, Text, TextInputProps, View } from 'react-native';
+import { NativeSyntheticEvent, StyleSheet, Text, TextInputFocusEventData, TextInputProps, View } from 'react-native';
import Touchable from 'react-native-platform-touchable';
import TextInput from '../presentation/TextInput';
@@ -45,13 +45,15 @@ const styles = StyleSheet.create({
});
interface ISearchBox {
+ value?: string;
onChangeText: TextInputProps['onChangeText'];
- onSubmitEditing: () => void;
- hasCancel: boolean;
- onCancelPress: Function;
- theme: string;
- inputRef: any;
+ onSubmitEditing?: () => void;
+ hasCancel?: boolean;
+ onCancelPress?: Function;
+ theme?: string;
+ inputRef?: React.Ref;
testID?: string;
+ onFocus?: (e: NativeSyntheticEvent) => void;
}
const CancelButton = (onCancelPress: Function, theme: string) => (
@@ -73,10 +75,10 @@ const SearchBox = ({
-
-
+
+
- {hasCancel ? CancelButton(onCancelPress, theme) : null}
+ {hasCancel ? CancelButton(onCancelPress!, theme!) : null}
);
diff --git a/app/containers/SearchHeader.js b/app/containers/SearchHeader.tsx
similarity index 80%
rename from app/containers/SearchHeader.js
rename to app/containers/SearchHeader.tsx
index e231d074..4b0a4917 100644
--- a/app/containers/SearchHeader.js
+++ b/app/containers/SearchHeader.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import { StyleSheet, View } from 'react-native';
-import PropTypes from 'prop-types';
import { withTheme } from '../theme';
import sharedStyles from '../views/Styles';
@@ -20,9 +19,14 @@ const styles = StyleSheet.create({
}
});
+interface ISearchHeader {
+ theme?: string;
+ onSearchChangeText?: (text: string) => void;
+}
+
// TODO: it might be useful to refactor this component for reusage
-const SearchHeader = ({ theme, onSearchChangeText }) => {
- const titleColorStyle = { color: themes[theme].headerTitleColor };
+const SearchHeader = ({ theme, onSearchChangeText }: ISearchHeader) => {
+ const titleColorStyle = { color: themes[theme!].headerTitleColor };
const isLight = theme === 'light';
const { isLandscape } = useOrientation();
const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1;
@@ -35,15 +39,11 @@ const SearchHeader = ({ theme, onSearchChangeText }) => {
style={[styles.title, isLight && titleColorStyle, { fontSize: titleFontSize }]}
placeholder='Search'
onChangeText={onSearchChangeText}
- theme={theme}
+ theme={theme!}
testID='thread-messages-view-search-header'
/>
);
};
-SearchHeader.propTypes = {
- theme: PropTypes.string,
- onSearchChangeText: PropTypes.func
-};
export default withTheme(SearchHeader);
diff --git a/app/containers/StatusBar.tsx b/app/containers/StatusBar.tsx
index da115f4e..5ebaf230 100644
--- a/app/containers/StatusBar.tsx
+++ b/app/containers/StatusBar.tsx
@@ -5,9 +5,9 @@ import { themes } from '../constants/colors';
import { withTheme } from '../theme';
interface IStatusBar {
- theme: string;
- barStyle: any;
- backgroundColor: string;
+ theme?: string;
+ barStyle?: any;
+ backgroundColor?: string;
}
const StatusBar = React.memo(({ theme, barStyle, backgroundColor }: IStatusBar) => {
@@ -17,7 +17,7 @@ const StatusBar = React.memo(({ theme, barStyle, backgroundColor }: IStatusBar)
barStyle = 'dark-content';
}
}
- return ;
+ return ;
});
export default withTheme(StatusBar);
diff --git a/app/containers/TextInput.tsx b/app/containers/TextInput.tsx
index 28ae1c2f..76cb1765 100644
--- a/app/containers/TextInput.tsx
+++ b/app/containers/TextInput.tsx
@@ -50,7 +50,7 @@ const styles = StyleSheet.create({
}
});
-interface IRCTextInputProps extends TextInputProps {
+export interface IRCTextInputProps extends TextInputProps {
label?: string;
error?: {
error: any;
diff --git a/app/containers/ThreadDetails.tsx b/app/containers/ThreadDetails.tsx
index 86f670f0..90f3faa4 100644
--- a/app/containers/ThreadDetails.tsx
+++ b/app/containers/ThreadDetails.tsx
@@ -1,11 +1,12 @@
import React from 'react';
-import { StyleSheet, Text, View } from 'react-native';
+import { StyleSheet, Text, View, ViewStyle } from 'react-native';
import Touchable from 'react-native-platform-touchable';
import { CustomIcon } from '../lib/Icons';
import { themes } from '../constants/colors';
import sharedStyles from '../views/Styles';
import { withTheme } from '../theme';
+import { TThreadModel } from '../definitions/IThread';
const styles = StyleSheet.create({
container: {
@@ -40,33 +41,25 @@ const styles = StyleSheet.create({
});
interface IThreadDetails {
- item: {
- tcount: number | string;
- replies: any;
- id: string;
- };
+ item: Partial;
user: {
id: string;
};
- badgeColor: string;
+ badgeColor?: string;
toggleFollowThread: Function;
- style: object;
- theme: string;
+ style: ViewStyle;
+ theme?: string;
}
const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style, theme }: IThreadDetails) => {
let { tcount } = item;
- if (tcount >= 1000) {
+ if (tcount! >= 1000) {
tcount = '+999';
- } else if (tcount >= 100) {
- tcount = '+99';
}
- let replies = item?.replies?.length ?? 0;
+ let replies: number | string = item?.replies?.length ?? 0;
if (replies >= 1000) {
replies = '+999';
- } else if (replies >= 100) {
- replies = '+99';
}
const isFollowing = item.replies?.find((u: any) => u === user?.id);
@@ -75,15 +68,15 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style, them
-
-
+
+
{tcount}
-
-
+
+
{replies}
@@ -95,7 +88,7 @@ const ThreadDetails = ({ item, user, badgeColor, toggleFollowThread, style, them
diff --git a/app/containers/Toast.tsx b/app/containers/Toast.tsx
index 79fcc827..7dca3e14 100644
--- a/app/containers/Toast.tsx
+++ b/app/containers/Toast.tsx
@@ -22,7 +22,7 @@ const styles = StyleSheet.create({
export const LISTENER = 'Toast';
interface IToastProps {
- theme: string;
+ theme?: string;
}
class Toast extends React.Component {
@@ -61,8 +61,8 @@ class Toast extends React.Component {
ref={this.getToastRef}
// @ts-ignore
position='center'
- style={[styles.toast, { backgroundColor: themes[theme].toastBackground }]}
- textStyle={[styles.text, { color: themes[theme].buttonText }]}
+ style={[styles.toast, { backgroundColor: themes[theme!].toastBackground }]}
+ textStyle={[styles.text, { color: themes[theme!].buttonText }]}
opacity={0.9}
/>
);
diff --git a/app/containers/TwoFactor/index.tsx b/app/containers/TwoFactor/index.tsx
index dd2686dd..5bb27774 100644
--- a/app/containers/TwoFactor/index.tsx
+++ b/app/containers/TwoFactor/index.tsx
@@ -19,7 +19,7 @@ import styles from './styles';
export const TWO_FACTOR = 'TWO_FACTOR';
interface ITwoFactor {
- theme: string;
+ theme?: string;
isMasterDetail: boolean;
}
@@ -87,7 +87,7 @@ const TwoFactor = React.memo(({ theme, isMasterDetail }: ITwoFactor) => {
setData({});
};
- const color = themes[theme].titleText;
+ const color = themes[theme!].titleText;
return (
{
style={[
styles.content,
isMasterDetail && [sharedStyles.modalFormSheet, styles.tablet],
- { backgroundColor: themes[theme].backgroundColor }
+ { backgroundColor: themes[theme!].backgroundColor }
]}>
{I18n.t(method?.title || 'Two_Factor_Authentication')}
{method?.text ? {I18n.t(method.text)} : null}
@@ -128,7 +128,7 @@ const TwoFactor = React.memo(({ theme, isMasterDetail }: ITwoFactor) => {