Chore: update `theme` type (#4025)

* chore: update `theme` type

* update: components

* update: storyshots

* add: `theme` type to `DirectoryItem`

* chore: update theme type on `message/index.tsx`

* update: `RoomTypeIcon`'s useTheme
This commit is contained in:
Gerzon Z 2022-04-12 12:27:05 -04:00 committed by GitHub
parent 4aeb21148d
commit b9651493d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
125 changed files with 377 additions and 280 deletions

View File

@ -5,6 +5,7 @@ import { themes } from '../lib/constants';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { getReadableVersion } from '../utils/deviceInfo'; import { getReadableVersion } from '../utils/deviceInfo';
import I18n from '../i18n'; import I18n from '../i18n';
import { TSupportedThemes } from '../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -20,7 +21,7 @@ const styles = StyleSheet.create({
} }
}); });
const AppVersion = React.memo(({ theme }: { theme: string }) => ( const AppVersion = React.memo(({ theme }: { theme: TSupportedThemes }) => (
<View style={styles.container}> <View style={styles.container}>
<Text style={[styles.text, { color: themes[theme].auxiliaryText }]}> <Text style={[styles.text, { color: themes[theme].auxiliaryText }]}>
{I18n.t('Version_no', { version: '' })} {I18n.t('Version_no', { version: '' })}

View File

@ -2,6 +2,7 @@ import React from 'react';
import { StyleSheet, Text } from 'react-native'; import { StyleSheet, Text } from 'react-native';
import Touchable from 'react-native-platform-touchable'; import Touchable from 'react-native-platform-touchable';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import sharedStyles from '../../views/Styles'; import sharedStyles from '../../views/Styles';
import ActivityIndicator from '../ActivityIndicator'; import ActivityIndicator from '../ActivityIndicator';
@ -13,7 +14,7 @@ interface IButtonProps {
disabled: boolean; disabled: boolean;
backgroundColor: string; backgroundColor: string;
loading: boolean; loading: boolean;
theme: string; theme: TSupportedThemes;
color: string; color: string;
fontSize: any; fontSize: any;
style: any; style: any;

View File

@ -6,13 +6,13 @@ import Avatar from '../Avatar';
import RoomTypeIcon from '../RoomTypeIcon'; import RoomTypeIcon from '../RoomTypeIcon';
import styles, { ROW_HEIGHT } from './styles'; import styles, { ROW_HEIGHT } from './styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
export { ROW_HEIGHT }; export { ROW_HEIGHT };
interface IDirectoryItemLabel { interface IDirectoryItemLabel {
text?: string; text?: string;
theme: string; theme: TSupportedThemes;
} }
interface IDirectoryItem { interface IDirectoryItem {
@ -54,7 +54,7 @@ const DirectoryItem = ({
<Avatar text={avatar} size={30} type={type} rid={rid} style={styles.directoryItemAvatar} /> <Avatar text={avatar} size={30} type={type} rid={rid} style={styles.directoryItemAvatar} />
<View style={styles.directoryItemTextContainer}> <View style={styles.directoryItemTextContainer}>
<View style={styles.directoryItemTextTitle}> <View style={styles.directoryItemTextTitle}>
<RoomTypeIcon type={type} teamMain={teamMain} theme={theme} /> <RoomTypeIcon type={type} teamMain={teamMain} />
<Text style={[styles.directoryItemName, { color: themes[theme].titleText }]} numberOfLines={1}> <Text style={[styles.directoryItemName, { color: themes[theme].titleText }]} numberOfLines={1}>
{title} {title}
</Text> </Text>

View File

@ -3,13 +3,14 @@ import { Text, TouchableOpacity, View } from 'react-native';
import styles from './styles'; import styles from './styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
interface ITabBarProps { interface ITabBarProps {
goToPage: Function; goToPage: Function;
activeTab: number; activeTab: number;
tabs: []; tabs: [];
tabEmojiStyle: object; tabEmojiStyle: object;
theme: string; theme: TSupportedThemes;
} }
export default class TabBar extends React.Component<Partial<ITabBarProps>> { export default class TabBar extends React.Component<Partial<ITabBarProps>> {

View File

@ -16,7 +16,7 @@ import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import shortnameToUnicode from '../../utils/shortnameToUnicode'; import shortnameToUnicode from '../../utils/shortnameToUnicode';
import log from '../../utils/log'; import log from '../../utils/log';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import { IEmoji } from '../../definitions/IEmoji'; import { IEmoji } from '../../definitions/IEmoji';
const scrollProps = { const scrollProps = {
@ -30,7 +30,7 @@ interface IEmojiPickerProps {
baseUrl: string; baseUrl: string;
customEmojis?: any; customEmojis?: any;
style: object; style: object;
theme?: string; theme: TSupportedThemes;
onEmojiSelected?: ((emoji: any) => void) | ((keyboardId: any, params?: any) => void); onEmojiSelected?: ((emoji: any) => void) | ((keyboardId: any, params?: any) => void);
tabEmojiStyle?: object; tabEmojiStyle?: object;
} }
@ -186,7 +186,7 @@ class EmojiPicker extends Component<IEmojiPickerProps, IEmojiPickerState> {
renderTabBar={() => <TabBar tabEmojiStyle={tabEmojiStyle} theme={theme} />} renderTabBar={() => <TabBar tabEmojiStyle={tabEmojiStyle} theme={theme} />}
/* @ts-ignore*/ /* @ts-ignore*/
contentProps={scrollProps} contentProps={scrollProps}
style={{ backgroundColor: themes[theme!].focusedBackground }}> style={{ backgroundColor: themes[theme].focusedBackground }}>
{categories.tabs.map((tab, i) => {categories.tabs.map((tab, i) =>
i === 0 && frequentlyUsed.length === 0 i === 0 && frequentlyUsed.length === 0
? null // when no frequentlyUsed don't show the tab ? null // when no frequentlyUsed don't show the tab

View File

@ -8,7 +8,7 @@ import { ICON_SIZE } from './constants';
interface IListIcon { interface IListIcon {
name: string; name: string;
color?: string; color?: string | null;
style?: StyleProp<ViewStyle>; style?: StyleProp<ViewStyle>;
testID?: string; testID?: string;
} }

View File

@ -4,7 +4,7 @@ import { I18nManager, StyleSheet, Text, View } from 'react-native';
import Touch from '../../utils/touch'; import Touch from '../../utils/touch';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import sharedStyles from '../../views/Styles'; import sharedStyles from '../../views/Styles';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
import I18n from '../../i18n'; import I18n from '../../i18n';
import { Icon } from '.'; import { Icon } from '.';
import { BASE_HEIGHT, ICON_SIZE, PADDING_HORIZONTAL } from './constants'; import { BASE_HEIGHT, ICON_SIZE, PADDING_HORIZONTAL } from './constants';
@ -59,7 +59,7 @@ interface IListItemContent {
left?: () => JSX.Element | null; left?: () => JSX.Element | null;
right?: () => JSX.Element | null; right?: () => JSX.Element | null;
disabled?: boolean; disabled?: boolean;
theme: string; theme: TSupportedThemes;
testID?: string; testID?: string;
color?: string; color?: string;
translateTitle?: boolean; translateTitle?: boolean;
@ -121,7 +121,7 @@ interface IListButtonPress extends IListItemButton {
interface IListItemButton { interface IListItemButton {
title?: string; title?: string;
disabled?: boolean; disabled?: boolean;
theme: string; theme: TSupportedThemes;
backgroundColor?: string; backgroundColor?: string;
underlayColor?: string; underlayColor?: string;
} }

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Animated, Modal, StyleSheet, View } from 'react-native'; import { Animated, Modal, StyleSheet, View } from 'react-native';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
@ -19,7 +19,7 @@ const styles = StyleSheet.create({
interface ILoadingProps { interface ILoadingProps {
visible: boolean; visible: boolean;
theme?: string; theme?: TSupportedThemes;
} }
interface ILoadingState { interface ILoadingState {

View File

@ -5,7 +5,7 @@ import { Base64 } from 'js-base64';
import * as AppleAuthentication from 'expo-apple-authentication'; import * as AppleAuthentication from 'expo-apple-authentication';
import { StackNavigationProp } from '@react-navigation/stack'; import { StackNavigationProp } from '@react-navigation/stack';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import Button from './Button'; import Button from './Button';
@ -100,7 +100,7 @@ interface ILoginServicesProps {
CAS_enabled: boolean; CAS_enabled: boolean;
CAS_login_url: string; CAS_login_url: string;
separator: boolean; separator: boolean;
theme: string; theme: TSupportedThemes;
} }
interface ILoginServicesState { interface ILoginServicesState {

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { FlatList, StyleSheet, Text, View } from 'react-native'; import { FlatList, StyleSheet, Text, View } from 'react-native';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { CustomIcon } from '../../lib/Icons'; import { CustomIcon } from '../../lib/Icons';
import shortnameToUnicode from '../../utils/shortnameToUnicode'; import shortnameToUnicode from '../../utils/shortnameToUnicode';
@ -29,12 +29,12 @@ interface THeaderItem {
item: TItem; item: TItem;
onReaction: TOnReaction; onReaction: TOnReaction;
server: string; server: string;
theme: string; theme: TSupportedThemes;
} }
interface THeaderFooter { interface THeaderFooter {
onReaction: TOnReaction; onReaction: TOnReaction;
theme: string; theme: TSupportedThemes;
} }
export const HEADER_HEIGHT = 36; export const HEADER_HEIGHT = 36;

View File

@ -6,11 +6,11 @@ import { store } from '../../lib/store/auxStore';
import EmojiPicker from '../EmojiPicker'; import EmojiPicker from '../EmojiPicker';
import styles from './styles'; import styles from './styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import { IEmoji } from '../../definitions/IEmoji'; import { IEmoji } from '../../definitions/IEmoji';
interface IMessageBoxEmojiKeyboard { interface IMessageBoxEmojiKeyboard {
theme: string; theme: TSupportedThemes;
} }
export default class EmojiKeyboard extends React.PureComponent<IMessageBoxEmojiKeyboard, any> { export default class EmojiKeyboard extends React.PureComponent<IMessageBoxEmojiKeyboard, any> {

View File

@ -10,9 +10,10 @@ import I18n from '../../i18n';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { CustomIcon } from '../../lib/Icons'; import { CustomIcon } from '../../lib/Icons';
import { events, logEvent } from '../../utils/log'; import { events, logEvent } from '../../utils/log';
import { TSupportedThemes } from '../../theme';
interface IMessageBoxRecordAudioProps { interface IMessageBoxRecordAudioProps {
theme: string; theme: TSupportedThemes;
permissionToUpload: boolean; permissionToUpload: boolean;
recordingCallback: Function; recordingCallback: Function;
onFinish: Function; onFinish: Function;

View File

@ -52,6 +52,7 @@ import { IMessage } from '../../definitions/IMessage';
import { forceJpgExtension } from './forceJpgExtension'; import { forceJpgExtension } from './forceJpgExtension';
import { IBaseScreen, IPreviewItem, IUser, TSubscriptionModel, TThreadModel } from '../../definitions'; import { IBaseScreen, IPreviewItem, IUser, TSubscriptionModel, TThreadModel } from '../../definitions';
import { MasterDetailInsideStackParamList } from '../../stacks/MasterDetailStack/types'; import { MasterDetailInsideStackParamList } from '../../stacks/MasterDetailStack/types';
import { TSupportedThemes } from '../../theme';
if (isAndroid) { if (isAndroid) {
require('./EmojiKeyboard'); require('./EmojiKeyboard');
@ -95,7 +96,7 @@ export interface IMessageBoxProps extends IBaseScreen<MasterDetailInsideStackPar
editRequest: Function; editRequest: Function;
onSubmit: Function; onSubmit: Function;
typing: Function; typing: Function;
theme: string; theme: TSupportedThemes;
replyCancel(): void; replyCancel(): void;
showSend: boolean; showSend: boolean;
children: JSX.Element; children: JSX.Element;

View File

@ -4,6 +4,7 @@ import { StyleSheet, Text, View } from 'react-native';
import I18n from '../i18n'; import I18n from '../i18n';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { TSupportedThemes } from '../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -24,7 +25,7 @@ const styles = StyleSheet.create({
}); });
interface IOrSeparator { interface IOrSeparator {
theme: string; theme: TSupportedThemes;
} }
const OrSeparator = React.memo(({ theme }: IOrSeparator) => { const OrSeparator = React.memo(({ theme }: IOrSeparator) => {

View File

@ -8,7 +8,7 @@ import I18n from '../i18n';
import { CustomIcon } from '../lib/Icons'; import { CustomIcon } from '../lib/Icons';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { useTheme, withTheme } from '../theme'; import { TSupportedThemes, useTheme, withTheme } from '../theme';
import { TGetCustomEmoji } from '../definitions/IEmoji'; import { TGetCustomEmoji } from '../definitions/IEmoji';
import { TMessageModel, ILoggedUser } from '../definitions'; import { TMessageModel, ILoggedUser } from '../definitions';
import SafeAreaView from './SafeAreaView'; import SafeAreaView from './SafeAreaView';
@ -77,7 +77,7 @@ interface IItem extends ISharedFields {
interface IModalContent extends ISharedFields { interface IModalContent extends ISharedFields {
message?: TMessageModel; message?: TMessageModel;
onClose: () => void; onClose: () => void;
theme: string; theme: TSupportedThemes;
} }
interface IReactionsModal extends ISharedFields { interface IReactionsModal extends ISharedFields {

View File

@ -67,7 +67,6 @@ interface IRoomHeader {
tmid: string; tmid: string;
teamMain: boolean; teamMain: boolean;
status: TUserStatus; status: TUserStatus;
theme?: string;
usersTyping: []; usersTyping: [];
isGroupChat: boolean; isGroupChat: boolean;
parentTitle: string; parentTitle: string;

View File

@ -4,7 +4,7 @@ import { StyleSheet, ViewStyle } from 'react-native';
import { CustomIcon } from '../lib/Icons'; import { CustomIcon } from '../lib/Icons';
import { STATUS_COLORS, themes } from '../lib/constants'; import { STATUS_COLORS, themes } from '../lib/constants';
import Status from './Status/Status'; import Status from './Status/Status';
import { withTheme } from '../theme'; import { useTheme } from '../theme';
import { TUserStatus } from '../definitions'; import { TUserStatus } from '../definitions';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
@ -14,7 +14,6 @@ const styles = StyleSheet.create({
}); });
interface IRoomTypeIcon { interface IRoomTypeIcon {
theme?: string;
type: string; type: string;
isGroupChat?: boolean; isGroupChat?: boolean;
teamMain?: boolean; teamMain?: boolean;
@ -23,12 +22,12 @@ interface IRoomTypeIcon {
style?: ViewStyle; style?: ViewStyle;
} }
const RoomTypeIcon = React.memo(({ type, isGroupChat, status, style, theme, teamMain, size = 16 }: IRoomTypeIcon) => { const RoomTypeIcon = React.memo(({ type, isGroupChat, status, style, teamMain, size = 16 }: IRoomTypeIcon) => {
const { theme } = useTheme();
if (!type) { if (!type) {
return null; return null;
} }
const color = themes[theme].titleText;
const color = themes[theme!].titleText;
const iconStyle = [styles.icon, { color }, style]; const iconStyle = [styles.icon, { color }, style];
if (type === 'd' && !isGroupChat) { if (type === 'd' && !isGroupChat) {
@ -59,4 +58,4 @@ const RoomTypeIcon = React.memo(({ type, isGroupChat, status, style, theme, team
return <CustomIcon name={icon} size={size} style={iconStyle} />; return <CustomIcon name={icon} size={size} style={iconStyle} />;
}); });
export default withTheme(RoomTypeIcon); export default RoomTypeIcon;

View File

@ -7,6 +7,7 @@ import TextInput from '../presentation/TextInput';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { CustomIcon } from '../lib/Icons'; import { CustomIcon } from '../lib/Icons';
import ActivityIndicator from './ActivityIndicator'; import ActivityIndicator from './ActivityIndicator';
import { TSupportedThemes } from '../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
error: { error: {
@ -62,7 +63,7 @@ export interface IRCTextInputProps extends TextInputProps {
iconRight?: string; iconRight?: string;
left?: JSX.Element; left?: JSX.Element;
onIconRightPress?(): void; onIconRightPress?(): void;
theme: string; theme: TSupportedThemes;
} }
interface IRCTextInputState { interface IRCTextInputState {

View File

@ -5,7 +5,7 @@ import EasyToast from 'react-native-easy-toast';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import EventEmitter from '../utils/events'; import EventEmitter from '../utils/events';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
toast: { toast: {
@ -22,7 +22,7 @@ const styles = StyleSheet.create({
export const LISTENER = 'Toast'; export const LISTENER = 'Toast';
interface IToastProps { interface IToastProps {
theme?: string; theme?: TSupportedThemes;
} }
class Toast extends React.Component<IToastProps, any> { class Toast extends React.Component<IToastProps, any> {

View File

@ -8,19 +8,20 @@ import { textParser } from '../utils';
import { CustomIcon } from '../../../lib/Icons'; import { CustomIcon } from '../../../lib/Icons';
import styles from './styles'; import styles from './styles';
import { IItemData } from '.'; import { IItemData } from '.';
import { TSupportedThemes } from '../../../theme';
interface IChip { interface IChip {
item: IItemData; item: IItemData;
onSelect: (item: IItemData) => void; onSelect: (item: IItemData) => void;
style?: object; style?: object;
theme: string; theme: TSupportedThemes;
} }
interface IChips { interface IChips {
items: IItemData[]; items: IItemData[];
onSelect: (item: IItemData) => void; onSelect: (item: IItemData) => void;
style?: object; style?: object;
theme: string; theme: TSupportedThemes;
} }
const keyExtractor = (item: IItemData) => item.value.toString(); const keyExtractor = (item: IItemData) => item.value.toString();

View File

@ -6,11 +6,12 @@ import { CustomIcon } from '../../../lib/Icons';
import { themes } from '../../../lib/constants'; import { themes } from '../../../lib/constants';
import ActivityIndicator from '../../ActivityIndicator'; import ActivityIndicator from '../../ActivityIndicator';
import styles from './styles'; import styles from './styles';
import { TSupportedThemes } from '../../../theme';
interface IInput { interface IInput {
children?: JSX.Element; children?: JSX.Element;
onPress: () => void; onPress: () => void;
theme: string; theme: TSupportedThemes;
inputStyle?: object; inputStyle?: object;
disabled?: boolean | null; disabled?: boolean | null;
placeholder?: string; placeholder?: string;

View File

@ -9,19 +9,20 @@ import { textParser } from '../utils';
import { themes } from '../../../lib/constants'; import { themes } from '../../../lib/constants';
import styles from './styles'; import styles from './styles';
import { IItemData } from '.'; import { IItemData } from '.';
import { TSupportedThemes } from '../../../theme';
interface IItem { interface IItem {
item: IItemData; item: IItemData;
selected?: string; selected?: string;
onSelect: Function; onSelect: Function;
theme: string; theme: TSupportedThemes;
} }
interface IItems { interface IItems {
items: IItemData[]; items: IItemData[];
selected: string[]; selected: string[];
onSelect: Function; onSelect: Function;
theme: string; theme: TSupportedThemes;
} }
const keyExtractor = (item: IItemData) => item.value.toString(); const keyExtractor = (item: IItemData) => item.value.toString();

View File

@ -1,3 +1,5 @@
import { TSupportedThemes } from '../../theme';
export enum ElementTypes { export enum ElementTypes {
IMAGE = 'image', IMAGE = 'image',
BUTTON = 'button', BUTTON = 'button',
@ -199,7 +201,7 @@ export interface IInput extends Partial<Block> {
description: string; description: string;
error: string; error: string;
hint: string; hint: string;
theme: string; theme: TSupportedThemes;
} }
export interface IInputIndex { export interface IInputIndex {
@ -231,7 +233,7 @@ export interface IOverflow extends Partial<Block> {
interface PropsOption { interface PropsOption {
onOptionPress: Function; onOptionPress: Function;
parser: IParser; parser: IParser;
theme: string; theme: TSupportedThemes;
} }
export interface IOptions extends PropsOption { export interface IOptions extends PropsOption {
options: Option[]; options: Option[];
@ -265,6 +267,6 @@ export interface ISection {
export interface IFields { export interface IFields {
parser: IParser; parser: IParser;
theme: string; theme: TSupportedThemes;
fields: any[]; fields: any[];
} }

View File

@ -6,6 +6,7 @@ import { CustomIcon } from '../lib/Icons';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { isIOS } from '../utils/deviceInfo'; import { isIOS } from '../utils/deviceInfo';
import { TSupportedThemes } from '../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
button: { button: {
@ -46,7 +47,7 @@ interface IUserItem {
onLongPress?: () => void; onLongPress?: () => void;
style?: StyleProp<ViewStyle>; style?: StyleProp<ViewStyle>;
icon?: string | null; icon?: string | null;
theme: string; theme: TSupportedThemes;
} }
const UserItem = ({ name, username, onPress, testID, onLongPress, style, icon, theme }: IUserItem) => ( const UserItem = ({ name, username, onPress, testID, onLongPress, style, icon, theme }: IUserItem) => (

View File

@ -1,12 +1,13 @@
import React from 'react'; import React from 'react';
import { View } from 'react-native'; import { View } from 'react-native';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import styles from './styles'; import styles from './styles';
interface IBlockQuote { interface IBlockQuote {
children: React.ReactElement | null; children: React.ReactElement | null;
theme: string; theme: TSupportedThemes;
} }
const BlockQuote = React.memo(({ children, theme }: IBlockQuote) => ( const BlockQuote = React.memo(({ children, theme }: IBlockQuote) => (

View File

@ -5,6 +5,7 @@ import shortnameToUnicode from '../../utils/shortnameToUnicode';
import CustomEmoji from '../EmojiPicker/CustomEmoji'; import CustomEmoji from '../EmojiPicker/CustomEmoji';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import styles from './styles'; import styles from './styles';
import { TSupportedThemes } from '../../theme';
interface IEmoji { interface IEmoji {
literal: string; literal: string;
@ -13,7 +14,7 @@ interface IEmoji {
baseUrl: string; baseUrl: string;
customEmojis?: any; customEmojis?: any;
style?: object; style?: object;
theme: string; theme: TSupportedThemes;
onEmojiSelected?: Function; onEmojiSelected?: Function;
tabEmojiStyle?: object; tabEmojiStyle?: object;
} }

View File

@ -9,11 +9,12 @@ import EventEmitter from '../../utils/events';
import I18n from '../../i18n'; import I18n from '../../i18n';
import openLink from '../../utils/openLink'; import openLink from '../../utils/openLink';
import { TOnLinkPress } from './interfaces'; import { TOnLinkPress } from './interfaces';
import { TSupportedThemes } from '../../theme';
interface ILink { interface ILink {
children: React.ReactElement | null; children: React.ReactElement | null;
link: string; link: string;
theme: string; theme: TSupportedThemes;
onLinkPress?: TOnLinkPress; onLinkPress?: TOnLinkPress;
} }

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import { StyleSheet, Text, View } from 'react-native'; import { StyleSheet, Text, View } from 'react-native';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
const style = StyleSheet.create({ const style = StyleSheet.create({
@ -23,7 +24,7 @@ interface IListItem {
level: number; level: number;
ordered: boolean; ordered: boolean;
continue: boolean; continue: boolean;
theme: string; theme: TSupportedThemes;
index: number; index: number;
} }

View File

@ -5,12 +5,13 @@ import { CELL_WIDTH } from './TableCell';
import styles from './styles'; import styles from './styles';
import Navigation from '../../lib/navigation/appNavigation'; import Navigation from '../../lib/navigation/appNavigation';
import I18n from '../../i18n'; import I18n from '../../i18n';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
interface ITable { interface ITable {
children: React.ReactElement | null; children: React.ReactElement | null;
numColumns: number; numColumns: number;
theme: string; theme: TSupportedThemes;
} }
const MAX_HEIGHT = 300; const MAX_HEIGHT = 300;

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import { Text, View, ViewStyle } from 'react-native'; import { Text, View, ViewStyle } from 'react-native';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import styles from './styles'; import styles from './styles';
@ -8,7 +9,7 @@ interface ITableCell {
align: '' | 'left' | 'center' | 'right'; align: '' | 'left' | 'center' | 'right';
children: React.ReactElement | null; children: React.ReactElement | null;
isLastCell: boolean; isLastCell: boolean;
theme: string; theme: TSupportedThemes;
} }
export const CELL_WIDTH = 100; export const CELL_WIDTH = 100;

View File

@ -1,13 +1,14 @@
import React from 'react'; import React from 'react';
import { View, ViewStyle } from 'react-native'; import { View, ViewStyle } from 'react-native';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import styles from './styles'; import styles from './styles';
interface ITableRow { interface ITableRow {
children: React.ReactElement | null; children: React.ReactElement | null;
isLastRow: boolean; isLastRow: boolean;
theme: string; theme: TSupportedThemes;
} }
const TableRow = React.memo(({ isLastRow, children: _children, theme }: ITableRow) => { const TableRow = React.memo(({ isLastRow, children: _children, theme }: ITableRow) => {

View File

@ -23,13 +23,14 @@ import { formatText } from './formatText';
import { IUserMention, IUserChannel, TOnLinkPress } from './interfaces'; import { IUserMention, IUserChannel, TOnLinkPress } from './interfaces';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../definitions/IEmoji';
import { formatHyperlink } from './formatHyperlink'; import { formatHyperlink } from './formatHyperlink';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
export { default as MarkdownPreview } from './Preview'; export { default as MarkdownPreview } from './Preview';
interface IMarkdownProps { interface IMarkdownProps {
msg?: string; msg?: string;
theme: string; theme: TSupportedThemes;
md?: MarkdownAST; md?: MarkdownAST;
mentions?: IUserMention[]; mentions?: IUserMention[];
getCustomEmoji?: TGetCustomEmoji; getCustomEmoji?: TGetCustomEmoji;

View File

@ -4,7 +4,7 @@ import { createImageProgress } from 'react-native-image-progress';
import * as Progress from 'react-native-progress'; import * as Progress from 'react-native-progress';
import FastImage from '@rocket.chat/react-native-fast-image'; import FastImage from '@rocket.chat/react-native-fast-image';
import { useTheme } from '../../../theme'; import { TSupportedThemes, useTheme } from '../../../theme';
import { themes } from '../../../lib/constants'; import { themes } from '../../../lib/constants';
import styles from '../../message/styles'; import styles from '../../message/styles';
@ -14,7 +14,7 @@ interface IImageProps {
type TMessageImage = { type TMessageImage = {
img: string; img: string;
theme: string; theme: TSupportedThemes;
}; };
const ImageProgress = createImageProgress(FastImage); const ImageProgress = createImageProgress(FastImage);

View File

@ -18,11 +18,12 @@ import ActivityIndicator from '../ActivityIndicator';
import { withDimensions } from '../../dimensions'; import { withDimensions } from '../../dimensions';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../definitions/IEmoji';
import { IAttachment } from '../../definitions'; import { IAttachment } from '../../definitions';
import { TSupportedThemes } from '../../theme';
interface IButton { interface IButton {
loading: boolean; loading: boolean;
paused: boolean; paused: boolean;
theme: string; theme: TSupportedThemes;
disabled?: boolean; disabled?: boolean;
onPress: () => void; onPress: () => void;
} }
@ -31,7 +32,7 @@ interface IMessageAudioProps {
file: IAttachment; file: IAttachment;
isReply?: boolean; isReply?: boolean;
style?: StyleProp<TextStyle>[]; style?: StyleProp<TextStyle>[];
theme: string; theme: TSupportedThemes;
getCustomEmoji: TGetCustomEmoji; getCustomEmoji: TGetCustomEmoji;
scale?: number; scale?: number;
} }
@ -264,6 +265,13 @@ class MessageAudio extends React.Component<IMessageAudioProps, IMessageAudioStat
return null; return null;
} }
let thumbColor;
if (isAndroid && isReply) {
thumbColor = themes[theme].tintDisabled;
} else if (isAndroid) {
thumbColor = themes[theme].tintColor;
}
return ( return (
<> <>
<Markdown <Markdown
@ -286,7 +294,7 @@ class MessageAudio extends React.Component<IMessageAudioProps, IMessageAudioStat
value={currentTime} value={currentTime}
maximumValue={duration} maximumValue={duration}
minimumValue={0} minimumValue={0}
thumbTintColor={isReply && isAndroid ? themes[theme].tintDisabled : isAndroid && themes[theme].tintColor} thumbTintColor={thumbColor}
minimumTrackTintColor={themes[theme].tintColor} minimumTrackTintColor={themes[theme].tintColor}
maximumTrackTintColor={themes[theme].auxiliaryText} maximumTrackTintColor={themes[theme].auxiliaryText}
onValueChange={this.onValueChange} onValueChange={this.onValueChange}

View File

@ -12,14 +12,14 @@ import { themes } from '../../lib/constants';
import MessageContext from './Context'; import MessageContext from './Context';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../definitions/IEmoji';
import { IAttachment } from '../../definitions'; import { IAttachment } from '../../definitions';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
import { formatAttachmentUrl } from '../../lib/methods/helpers/formatAttachmentUrl'; import { formatAttachmentUrl } from '../../lib/methods/helpers/formatAttachmentUrl';
interface IMessageButton { interface IMessageButton {
children: React.ReactElement; children: React.ReactElement;
disabled?: boolean; disabled?: boolean;
onPress: () => void; onPress: () => void;
theme: string; theme: TSupportedThemes;
} }
interface IMessageImage { interface IMessageImage {
@ -43,7 +43,7 @@ const Button = React.memo(({ children, onPress, disabled, theme }: IMessageButto
</Touchable> </Touchable>
)); ));
export const MessageImage = React.memo(({ imgUri, theme }: { imgUri: string; theme: string }) => ( export const MessageImage = React.memo(({ imgUri, theme }: { imgUri: string; theme: TSupportedThemes }) => (
<ImageProgress <ImageProgress
style={[styles.image, { borderColor: themes[theme].borderColor }]} style={[styles.image, { borderColor: themes[theme].borderColor }]}
source={{ uri: encodeURI(imgUri) }} source={{ uri: encodeURI(imgUri) }}

View File

@ -126,7 +126,7 @@ const MessageTouchable = React.memo((props: IMessageTouchable & IMessage) => {
onLongPress={onLongPress} onLongPress={onLongPress}
onPress={onPress} onPress={onPress}
disabled={(props.isInfo && !props.isThreadReply) || props.archived || props.isTemp || props.type === 'jitsi_call_started'} disabled={(props.isInfo && !props.isThreadReply) || props.archived || props.isTemp || props.type === 'jitsi_call_started'}
style={{ backgroundColor: props.highlighted ? themes[theme].headerBackground : null }}> style={{ backgroundColor: props.highlighted ? themes[theme].headerBackground : undefined }}>
<View> <View>
<Message {...props} /> <Message {...props} />
</View> </View>

View File

@ -7,7 +7,7 @@ import styles from './styles';
import Emoji from './Emoji'; import Emoji from './Emoji';
import { BUTTON_HIT_SLOP } from './utils'; import { BUTTON_HIT_SLOP } from './utils';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
import MessageContext from './Context'; import MessageContext from './Context';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../definitions/IEmoji';
@ -20,7 +20,7 @@ interface IReaction {
interface IMessageReaction { interface IMessageReaction {
reaction: IReaction; reaction: IReaction;
getCustomEmoji: TGetCustomEmoji; getCustomEmoji: TGetCustomEmoji;
theme: string; theme: TSupportedThemes;
} }
interface IMessageReactions { interface IMessageReactions {
@ -28,7 +28,7 @@ interface IMessageReactions {
getCustomEmoji: TGetCustomEmoji; getCustomEmoji: TGetCustomEmoji;
} }
const AddReaction = React.memo(({ theme }: { theme: string }) => { const AddReaction = React.memo(({ theme }: { theme: TSupportedThemes }) => {
const { reactionInit } = useContext(MessageContext); const { reactionInit } = useContext(MessageContext);
return ( return (
<Touchable <Touchable

View File

@ -15,7 +15,7 @@ import { IAttachment } from '../../definitions/IAttachment';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../definitions/IEmoji';
import RCActivityIndicator from '../ActivityIndicator'; import RCActivityIndicator from '../ActivityIndicator';
import Attachments from './Attachments'; import Attachments from './Attachments';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
import { formatAttachmentUrl } from '../../lib/methods/helpers/formatAttachmentUrl'; import { formatAttachmentUrl } from '../../lib/methods/helpers/formatAttachmentUrl';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
@ -98,21 +98,31 @@ interface IMessageReply {
getCustomEmoji: TGetCustomEmoji; getCustomEmoji: TGetCustomEmoji;
} }
const Title = React.memo(({ attachment, timeFormat, theme }: { attachment: IAttachment; timeFormat?: string; theme: string }) => { const Title = React.memo(
const time = attachment.message_link && attachment.ts ? moment(attachment.ts).format(timeFormat) : null; ({ attachment, timeFormat, theme }: { attachment: IAttachment; timeFormat?: string; theme: TSupportedThemes }) => {
return ( const time = attachment.message_link && attachment.ts ? moment(attachment.ts).format(timeFormat) : null;
<View style={styles.authorContainer}> return (
{attachment.author_name ? ( <View style={styles.authorContainer}>
<Text style={[styles.author, { color: themes[theme].auxiliaryTintColor }]}>{attachment.author_name}</Text> {attachment.author_name ? (
) : null} <Text style={[styles.author, { color: themes[theme].auxiliaryTintColor }]}>{attachment.author_name}</Text>
{attachment.title ? <Text style={[styles.title, { color: themes[theme].bodyText }]}>{attachment.title}</Text> : null} ) : null}
{time ? <Text style={[styles.time, { color: themes[theme].auxiliaryTintColor }]}>{time}</Text> : null} {attachment.title ? <Text style={[styles.title, { color: themes[theme].bodyText }]}>{attachment.title}</Text> : null}
</View> {time ? <Text style={[styles.time, { color: themes[theme].auxiliaryTintColor }]}>{time}</Text> : null}
); </View>
}); );
}
);
const Description = React.memo( const Description = React.memo(
({ attachment, getCustomEmoji, theme }: { attachment: IAttachment; getCustomEmoji: TGetCustomEmoji; theme: string }) => { ({
attachment,
getCustomEmoji,
theme
}: {
attachment: IAttachment;
getCustomEmoji: TGetCustomEmoji;
theme: TSupportedThemes;
}) => {
const { baseUrl, user } = useContext(MessageContext); const { baseUrl, user } = useContext(MessageContext);
const text = attachment.text || attachment.title; const text = attachment.text || attachment.title;
@ -160,7 +170,15 @@ const UrlImage = React.memo(
); );
const Fields = React.memo( const Fields = React.memo(
({ attachment, theme, getCustomEmoji }: { attachment: IAttachment; theme: string; getCustomEmoji: TGetCustomEmoji }) => { ({
attachment,
theme,
getCustomEmoji
}: {
attachment: IAttachment;
theme: TSupportedThemes;
getCustomEmoji: TGetCustomEmoji;
}) => {
const { baseUrl, user } = useContext(MessageContext); const { baseUrl, user } = useContext(MessageContext);
if (!attachment.fields) { if (!attachment.fields) {

View File

@ -8,7 +8,7 @@ import Touchable from './Touchable';
import openLink from '../../utils/openLink'; import openLink from '../../utils/openLink';
import sharedStyles from '../../views/Styles'; import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { useTheme, withTheme } from '../../theme'; import { TSupportedThemes, useTheme, withTheme } from '../../theme';
import { LISTENER } from '../Toast'; import { LISTENER } from '../Toast';
import EventEmitter from '../../utils/events'; import EventEmitter from '../../utils/events';
import I18n from '../../i18n'; import I18n from '../../i18n';
@ -66,7 +66,7 @@ const UrlImage = React.memo(
); );
const UrlContent = React.memo( const UrlContent = React.memo(
({ title, description, theme }: { title: string; description: string; theme: string }) => ( ({ title, description, theme }: { title: string; description: string; theme: TSupportedThemes }) => (
<View style={styles.textContainer}> <View style={styles.textContainer}>
{title ? ( {title ? (
<Text style={[styles.title, { color: themes[theme].tintColor }]} numberOfLines={2}> <Text style={[styles.title, { color: themes[theme].tintColor }]} numberOfLines={2}>
@ -95,7 +95,7 @@ const UrlContent = React.memo(
); );
const Url = React.memo( const Url = React.memo(
({ url, index, theme }: { url: IUrl; index: number; theme: string }) => { ({ url, index, theme }: { url: IUrl; index: number; theme: TSupportedThemes }) => {
if (!url || url?.ignoreParse) { if (!url || url?.ignoreParse) {
return null; return null;
} }

View File

@ -6,7 +6,7 @@ import Message from './Message';
import MessageContext from './Context'; import MessageContext from './Context';
import debounce from '../../utils/debounce'; import debounce from '../../utils/debounce';
import { SYSTEM_MESSAGES, getMessageTranslation } from './utils'; import { SYSTEM_MESSAGES, getMessageTranslation } from './utils';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import openLink from '../../utils/openLink'; import openLink from '../../utils/openLink';
import { TGetCustomEmoji } from '../../definitions/IEmoji'; import { TGetCustomEmoji } from '../../definitions/IEmoji';
import { IAttachment, TAnyMessageModel } from '../../definitions'; import { IAttachment, TAnyMessageModel } from '../../definitions';
@ -57,7 +57,7 @@ interface IMessageContainerProps {
toggleFollowThread?: (isFollowingThread: boolean, tmid?: string) => Promise<void>; toggleFollowThread?: (isFollowingThread: boolean, tmid?: string) => Promise<void>;
jumpToMessage?: (link: string) => void; jumpToMessage?: (link: string) => void;
onPress?: () => void; onPress?: () => void;
theme: string; theme: TSupportedThemes;
} }
interface IMessageContainerState { interface IMessageContainerState {
@ -73,7 +73,7 @@ class MessageContainer extends React.Component<IMessageContainerProps, IMessageC
archived: false, archived: false,
broadcast: false, broadcast: false,
isIgnored: false, isIgnored: false,
theme: 'light' theme: 'light' as TSupportedThemes
}; };
state = { isManualUnignored: false }; state = { isManualUnignored: false };

View File

@ -1,11 +1,12 @@
import { TextInput } from 'react-native'; import { TextInput } from 'react-native';
import { TSupportedThemes } from '../theme';
import { ILivechatVisitor } from './ILivechatVisitor'; import { ILivechatVisitor } from './ILivechatVisitor';
import { ISubscription } from './ISubscription'; import { ISubscription } from './ISubscription';
export interface ITitle { export interface ITitle {
title: string; title: string;
theme: string; theme: TSupportedThemes;
} }
export interface IInputs { export interface IInputs {

View File

@ -1,6 +1,7 @@
import { StackNavigationProp } from '@react-navigation/stack'; import { StackNavigationProp } from '@react-navigation/stack';
import React from 'react'; import React from 'react';
import { TSupportedThemes } from '../theme';
import { ProfileStackParamList } from '../stacks/types'; import { ProfileStackParamList } from '../stacks/types';
import { IUser } from './IUser'; import { IUser } from './IUser';
@ -34,7 +35,7 @@ export interface IProfileViewProps {
Accounts_AllowUsernameChange: boolean; Accounts_AllowUsernameChange: boolean;
Accounts_CustomFields: string; Accounts_CustomFields: string;
setUser: Function; setUser: Function;
theme: string; theme: TSupportedThemes;
} }
export interface IAvatar { export interface IAvatar {

View File

@ -2,7 +2,7 @@ import { RouteProp } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack'; import { StackNavigationProp } from '@react-navigation/stack';
import { Dispatch } from 'redux'; import { Dispatch } from 'redux';
import { TColors } from '../theme'; import { TColors, TSupportedThemes } from '../theme';
export * from './IAttachment'; export * from './IAttachment';
export * from './INotification'; export * from './INotification';
@ -36,7 +36,7 @@ export interface IBaseScreen<T extends Record<string, object | undefined>, S ext
dispatch: Dispatch; dispatch: Dispatch;
isMasterDetail: boolean; isMasterDetail: boolean;
// TODO: remove after migrating all Class components // TODO: remove after migrating all Class components
theme: string; theme: TSupportedThemes;
colors: TColors; colors: TColors;
} }

View File

@ -9,7 +9,7 @@ import I18n from '../../../i18n';
import RoomItem, { ROW_HEIGHT } from '../../../presentation/RoomItem'; import RoomItem, { ROW_HEIGHT } from '../../../presentation/RoomItem';
import { isIOS, isTablet } from '../../../utils/deviceInfo'; import { isIOS, isTablet } from '../../../utils/deviceInfo';
import { getUserSelector } from '../../../selectors/login'; import { getUserSelector } from '../../../selectors/login';
import { withTheme } from '../../../theme'; import { TSupportedThemes, withTheme } from '../../../theme';
import { withDimensions } from '../../../dimensions'; import { withDimensions } from '../../../dimensions';
import SafeAreaView from '../../../containers/SafeAreaView'; import SafeAreaView from '../../../containers/SafeAreaView';
import StatusBar from '../../../containers/StatusBar'; import StatusBar from '../../../containers/StatusBar';
@ -42,7 +42,7 @@ interface IQueueListView extends INavigationOptions {
queued: IOmnichannelRoom[]; queued: IOmnichannelRoom[];
server: string; server: string;
useRealName?: TSettingsValues; useRealName?: TSettingsValues;
theme: string; theme: TSupportedThemes;
showAvatar: any; showAvatar: any;
displayMode: DisplayMode; displayMode: DisplayMode;
} }

View File

@ -175,4 +175,4 @@ export const colors = {
} }
}; };
export const themes: any = colors; export const themes = colors;

View File

@ -5,6 +5,7 @@ import Animated, { EasingNode } from 'react-native-reanimated';
import { ImageComponent } from './ImageComponent'; import { ImageComponent } from './ImageComponent';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
flex: { flex: {
@ -226,7 +227,7 @@ interface IImageViewerProps {
uri: string; uri: string;
width: number; width: number;
height: number; height: number;
theme: string; theme: TSupportedThemes;
imageComponentType: string; imageComponentType: string;
} }

View File

@ -3,6 +3,7 @@ import { ScrollView, StyleSheet } from 'react-native';
import { ImageComponent } from './ImageComponent'; import { ImageComponent } from './ImageComponent';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
scrollContent: { scrollContent: {
@ -19,7 +20,7 @@ interface IImageViewer {
imageComponentType?: string; imageComponentType?: string;
width: number; width: number;
height: number; height: number;
theme: string; theme: TSupportedThemes;
onLoadEnd?: () => void; onLoadEnd?: () => void;
} }

View File

@ -6,9 +6,10 @@ import { isRTL } from '../../i18n';
import { CustomIcon } from '../../lib/Icons'; import { CustomIcon } from '../../lib/Icons';
import { DisplayMode, themes } from '../../lib/constants'; import { DisplayMode, themes } from '../../lib/constants';
import styles, { ACTION_WIDTH, LONG_SWIPE, ROW_HEIGHT_CONDENSED } from './styles'; import styles, { ACTION_WIDTH, LONG_SWIPE, ROW_HEIGHT_CONDENSED } from './styles';
import { TSupportedThemes } from '../../theme';
interface ILeftActions { interface ILeftActions {
theme: string; theme: TSupportedThemes;
transX: any; transX: any;
isRead: boolean; isRead: boolean;
width: number; width: number;
@ -17,7 +18,7 @@ interface ILeftActions {
} }
interface IRightActions { interface IRightActions {
theme: string; theme: TSupportedThemes;
transX: any; transX: any;
favorite: boolean; favorite: boolean;
width: number; width: number;

View File

@ -5,9 +5,10 @@ import I18n from '../../i18n';
import styles from './styles'; import styles from './styles';
import { MarkdownPreview } from '../../containers/markdown'; import { MarkdownPreview } from '../../containers/markdown';
import { E2E_MESSAGE_TYPE, E2E_STATUS, themes } from '../../lib/constants'; import { E2E_MESSAGE_TYPE, E2E_STATUS, themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
interface ILastMessage { interface ILastMessage {
theme: string; theme: TSupportedThemes;
lastMessage: { lastMessage: {
u: any; u: any;
pinned: boolean; pinned: boolean;

View File

@ -13,6 +13,7 @@ import Tag from './Tag';
import I18n from '../../i18n'; import I18n from '../../i18n';
import { DisplayMode } from '../../lib/constants'; import { DisplayMode } from '../../lib/constants';
import { TUserStatus } from '../../definitions'; import { TUserStatus } from '../../definitions';
import { TSupportedThemes } from '../../theme';
interface IRoomItem { interface IRoomItem {
rid: string; rid: string;
@ -27,7 +28,7 @@ interface IRoomItem {
width: number; width: number;
status: TUserStatus; status: TUserStatus;
useRealName: boolean; useRealName: boolean;
theme: string; theme: TSupportedThemes;
isFocused: boolean; isFocused: boolean;
isGroupChat: boolean; isGroupChat: boolean;
isRead: boolean; isRead: boolean;
@ -137,7 +138,7 @@ const RoomItem = ({
<> <>
<View style={styles.titleContainer}> <View style={styles.titleContainer}>
{showAvatar ? ( {showAvatar ? (
<TypeIcon type={type} prid={prid} status={status} isGroupChat={isGroupChat} theme={theme} teamMain={teamMain} /> <TypeIcon type={type} prid={prid} status={status} isGroupChat={isGroupChat} teamMain={teamMain} />
) : null} ) : null}
<Title name={name} theme={theme} hideUnreadStatus={hideUnreadStatus} alert={alert} /> <Title name={name} theme={theme} hideUnreadStatus={hideUnreadStatus} alert={alert} />
{autoJoin ? <Tag testID='auto-join-tag' name={I18n.t('Auto-join')} /> : null} {autoJoin ? <Tag testID='auto-join-tag' name={I18n.t('Auto-join')} /> : null}
@ -170,7 +171,6 @@ const RoomItem = ({
prid={prid} prid={prid}
status={status} status={status}
isGroupChat={isGroupChat} isGroupChat={isGroupChat}
theme={theme}
teamMain={teamMain} teamMain={teamMain}
size={22} size={22}
style={{ marginRight: 8 }} style={{ marginRight: 8 }}

View File

@ -11,7 +11,7 @@ interface ITag {
} }
const Tag = React.memo(({ name, testID }: ITag) => { const Tag = React.memo(({ name, testID }: ITag) => {
const { theme }: any = useTheme(); const { theme } = useTheme();
return ( return (
<View style={[styles.tagContainer, { backgroundColor: themes[theme].borderColor }]}> <View style={[styles.tagContainer, { backgroundColor: themes[theme].borderColor }]}>

View File

@ -3,10 +3,11 @@ import { Text } from 'react-native';
import styles from './styles'; import styles from './styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
interface ITitle { interface ITitle {
name: string; name: string;
theme: string; theme: TSupportedThemes;
hideUnreadStatus: boolean; hideUnreadStatus: boolean;
alert: boolean; alert: boolean;
} }

View File

@ -7,6 +7,7 @@ import { ACTION_WIDTH, LONG_SWIPE, SMALL_SWIPE } from './styles';
import { isRTL } from '../../i18n'; import { isRTL } from '../../i18n';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { LeftActions, RightActions } from './Actions'; import { LeftActions, RightActions } from './Actions';
import { TSupportedThemes } from '../../theme';
interface ITouchableProps { interface ITouchableProps {
children: JSX.Element; children: JSX.Element;
@ -21,7 +22,7 @@ interface ITouchableProps {
toggleFav: Function; toggleFav: Function;
toggleRead: Function; toggleRead: Function;
hideChannel: Function; hideChannel: Function;
theme: string; theme: TSupportedThemes;
isFocused: boolean; isFocused: boolean;
swipeEnabled: boolean; swipeEnabled: boolean;
displayMode: string; displayMode: string;

View File

@ -9,7 +9,6 @@ interface ITypeIcon {
prid: string; prid: string;
isGroupChat: boolean; isGroupChat: boolean;
teamMain: boolean; teamMain: boolean;
theme?: string;
size?: number; size?: number;
style?: object; style?: object;
} }

View File

@ -4,10 +4,11 @@ import { Text } from 'react-native';
import styles from './styles'; import styles from './styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { capitalize } from '../../utils/room'; import { capitalize } from '../../utils/room';
import { TSupportedThemes } from '../../theme';
interface IUpdatedAt { interface IUpdatedAt {
date: string; date: string;
theme: string; theme: TSupportedThemes;
hideUnreadStatus: boolean; hideUnreadStatus: boolean;
alert: boolean; alert: boolean;
} }

View File

@ -2,6 +2,7 @@ import React from 'react';
import { View } from 'react-native'; import { View } from 'react-native';
import { DisplayMode, themes } from '../../lib/constants'; import { DisplayMode, themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
import IconOrAvatar from './IconOrAvatar'; import IconOrAvatar from './IconOrAvatar';
import styles from './styles'; import styles from './styles';
@ -10,7 +11,7 @@ interface IWrapper {
avatar: string; avatar: string;
avatarSize: number; avatarSize: number;
type: string; type: string;
theme: string; theme: TSupportedThemes;
rid: string; rid: string;
children: JSX.Element; children: JSX.Element;
displayMode: string; displayMode: string;

View File

@ -6,6 +6,7 @@ import { ROW_HEIGHT, ROW_HEIGHT_CONDENSED } from './styles';
import { formatDate } from '../../utils/room'; import { formatDate } from '../../utils/room';
import RoomItem from './RoomItem'; import RoomItem from './RoomItem';
import { TUserStatus } from '../../definitions'; import { TUserStatus } from '../../definitions';
import { TSupportedThemes } from '../../theme';
export { ROW_HEIGHT, ROW_HEIGHT_CONDENSED }; export { ROW_HEIGHT, ROW_HEIGHT_CONDENSED };
interface IRoomItemContainerProps { interface IRoomItemContainerProps {
@ -24,7 +25,7 @@ interface IRoomItemContainerProps {
useRealName: boolean; useRealName: boolean;
getUserPresence: Function; getUserPresence: Function;
connected: boolean; connected: boolean;
theme: string; theme: TSupportedThemes;
isFocused: boolean; isFocused: boolean;
getRoomTitle: Function; getRoomTitle: Function;
getRoomAvatar: Function; getRoomAvatar: Function;

View File

@ -3,6 +3,7 @@ import { I18nManager, StyleProp, StyleSheet, TextInput, TextStyle } from 'react-
import { IRCTextInputProps } from '../containers/TextInput'; import { IRCTextInputProps } from '../containers/TextInput';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { TSupportedThemes } from '../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
input: { input: {
@ -12,7 +13,7 @@ const styles = StyleSheet.create({
export interface IThemedTextInput extends IRCTextInputProps { export interface IThemedTextInput extends IRCTextInputProps {
style: StyleProp<TextStyle>; style: StyleProp<TextStyle>;
theme: string; theme: TSupportedThemes;
} }
const ThemedTextInput = React.forwardRef<TextInput, IThemedTextInput>(({ style, theme, ...props }, ref) => ( const ThemedTextInput = React.forwardRef<TextInput, IThemedTextInput>(({ style, theme, ...props }, ref) => (

View File

@ -1,17 +1,36 @@
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
export const getUnreadStyle = ({ unread, userMentions, groupMentions, theme, tunread, tunreadUser, tunreadGroup }: any) => { interface IGetUnreadStyle {
unread?: number;
userMentions?: number;
groupMentions?: number;
theme: TSupportedThemes;
tunread?: [];
tunreadUser?: [];
tunreadGroup?: [];
}
export const getUnreadStyle = ({
unread,
userMentions,
groupMentions,
theme,
tunread,
tunreadUser,
tunreadGroup
}: IGetUnreadStyle) => {
if ((!unread || unread <= 0) && !tunread?.length) { if ((!unread || unread <= 0) && !tunread?.length) {
return {}; return {};
} }
let backgroundColor = themes[theme].unreadColor; let backgroundColor = themes[theme].unreadColor;
const color = themes[theme].buttonText; const color = themes[theme].buttonText;
if (userMentions > 0 || tunreadUser?.length) { if ((userMentions && userMentions > 0) || tunreadUser?.length) {
backgroundColor = themes[theme].mentionMeColor; backgroundColor = themes[theme].mentionMeColor;
} else if (groupMentions > 0 || tunreadGroup?.length) { } else if ((groupMentions && groupMentions > 0) || tunreadGroup?.length) {
backgroundColor = themes[theme].mentionGroupColor; backgroundColor = themes[theme].mentionGroupColor;
} else if (tunread?.length > 0) { } else if (tunread && tunread?.length > 0) {
backgroundColor = themes[theme].tunreadColor; backgroundColor = themes[theme].tunreadColor;
} }

View File

@ -3,7 +3,7 @@ import { StyleSheet, Text, View, ViewStyle } from 'react-native';
import sharedStyles from '../../views/Styles'; import sharedStyles from '../../views/Styles';
import { getUnreadStyle } from './getUnreadStyle'; import { getUnreadStyle } from './getUnreadStyle';
import { withTheme } from '../../theme'; import { useTheme } from '../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
unreadNumberContainerNormal: { unreadNumberContainerNormal: {
@ -30,7 +30,6 @@ const styles = StyleSheet.create({
}); });
interface IUnreadBadge { interface IUnreadBadge {
theme?: string;
unread?: number; unread?: number;
userMentions?: number; userMentions?: number;
groupMentions?: number; groupMentions?: number;
@ -42,10 +41,12 @@ interface IUnreadBadge {
} }
const UnreadBadge = React.memo( const UnreadBadge = React.memo(
({ theme, unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small }: IUnreadBadge) => { ({ unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small }: IUnreadBadge) => {
const { theme } = useTheme();
if ((!unread || unread <= 0) && !tunread?.length) { if ((!unread || unread <= 0) && !tunread?.length) {
return null; return null;
} }
const { backgroundColor, color } = getUnreadStyle({ const { backgroundColor, color } = getUnreadStyle({
theme, theme,
unread, unread,
@ -88,4 +89,4 @@ const UnreadBadge = React.memo(
} }
); );
export default withTheme(UnreadBadge); export default UnreadBadge;

View File

@ -5,11 +5,12 @@ import { NavigationContainerProps } from '@react-navigation/core';
import sharedStyles from '../../views/Styles'; import sharedStyles from '../../views/Styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
interface IModalContainer extends NavigationContainerProps { interface IModalContainer extends NavigationContainerProps {
navigation: StackNavigationProp<any>; navigation: StackNavigationProp<any>;
children: React.ReactNode; children: React.ReactNode;
theme: string; theme: TSupportedThemes;
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({

View File

@ -9,7 +9,7 @@ export type TSupportedThemes = keyof typeof colors;
export type TColors = typeof colors[TSupportedThemes]; export type TColors = typeof colors[TSupportedThemes];
interface IThemeContextProps { interface IThemeContextProps {
theme: string; theme: TSupportedThemes;
themePreferences?: IThemePreference; themePreferences?: IThemePreference;
setTheme?: (newTheme?: {}) => void; setTheme?: (newTheme?: {}) => void;
colors: TColors; colors: TColors;

View File

@ -2,6 +2,7 @@ import { StyleSheet } from 'react-native';
import { DarkTheme, DefaultTheme } from '@react-navigation/native'; import { DarkTheme, DefaultTheme } from '@react-navigation/native';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes } from '../../theme';
export * from './animations'; export * from './animations';
@ -15,13 +16,13 @@ export const cardStyle = {
backgroundColor: 'rgba(0,0,0,0)' backgroundColor: 'rgba(0,0,0,0)'
}; };
export const borderBottom: any = (theme: any) => ({ export const borderBottom: any = (theme: TSupportedThemes) => ({
borderBottomWidth: StyleSheet.hairlineWidth, borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: themes[theme].headerBorder, borderBottomColor: themes[theme].headerBorder,
elevation: 0 elevation: 0
}); });
export const themedHeader = (theme: any) => ({ export const themedHeader = (theme: TSupportedThemes) => ({
headerStyle: { headerStyle: {
...borderBottom(theme), ...borderBottom(theme),
backgroundColor: themes[theme].headerBackground backgroundColor: themes[theme].headerBackground
@ -30,7 +31,7 @@ export const themedHeader = (theme: any) => ({
headerTitleStyle: { color: themes[theme].headerTitleColor } headerTitleStyle: { color: themes[theme].headerTitleColor }
}); });
export const navigationTheme = (theme: any) => { export const navigationTheme = (theme: TSupportedThemes) => {
const defaultNavTheme = theme === 'light' ? DefaultTheme : DarkTheme; const defaultNavTheme = theme === 'light' ? DefaultTheme : DarkTheme;
return { return {

View File

@ -3,6 +3,7 @@ import * as WebBrowser from 'expo-web-browser';
import parse from 'url-parse'; import parse from 'url-parse';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { TSupportedThemes } from '../theme';
import UserPreferences from '../lib/methods/userPreferences'; import UserPreferences from '../lib/methods/userPreferences';
export const DEFAULT_BROWSER_KEY = 'DEFAULT_BROWSER_KEY'; export const DEFAULT_BROWSER_KEY = 'DEFAULT_BROWSER_KEY';
@ -35,7 +36,7 @@ const appSchemeURL = (url: string, browser: string): string => {
return schemeUrl; return schemeUrl;
}; };
const openLink = async (url: string, theme = 'light'): Promise<void> => { const openLink = async (url: string, theme: TSupportedThemes = 'light'): Promise<void> => {
try { try {
const browser = UserPreferences.getString(DEFAULT_BROWSER_KEY); const browser = UserPreferences.getString(DEFAULT_BROWSER_KEY);

View File

@ -4,6 +4,7 @@ import { themes } from '../lib/constants';
import I18n from '../i18n'; import I18n from '../i18n';
import { IAttachment } from '../definitions/IAttachment'; import { IAttachment } from '../definitions/IAttachment';
import { SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription'; import { SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription';
import { TSupportedThemes } from '../theme';
export const isBlocked = (room: TSubscriptionModel): boolean => { export const isBlocked = (room: TSubscriptionModel): boolean => {
if (room) { if (room) {
@ -46,7 +47,7 @@ export const getBadgeColor = ({
// TODO: Refactor when migrate model folder // TODO: Refactor when migrate model folder
subscription: any; subscription: any;
messageId: string; messageId: string;
theme: string; theme: TSupportedThemes;
}): string | undefined => { }): string | undefined => {
if (subscription?.tunreadUser?.includes(messageId)) { if (subscription?.tunreadUser?.includes(messageId)) {
return themes[theme].mentionMeColor; return themes[theme].mentionMeColor;

View File

@ -1,11 +1,12 @@
import React from 'react'; import React from 'react';
import { RectButton, RectButtonProps } from 'react-native-gesture-handler'; import { RectButton, RectButtonProps } from 'react-native-gesture-handler';
import { TSupportedThemes } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
interface ITouchProps extends RectButtonProps { interface ITouchProps extends RectButtonProps {
children: React.ReactNode; children: React.ReactNode;
theme: string; theme: TSupportedThemes;
accessibilityLabel?: string; accessibilityLabel?: string;
testID?: string; testID?: string;
} }

View File

@ -14,7 +14,7 @@ import SearchBox from '../containers/SearchBox';
import * as HeaderButton from '../containers/HeaderButton'; import * as HeaderButton from '../containers/HeaderButton';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import SafeAreaView from '../containers/SafeAreaView'; import SafeAreaView from '../containers/SafeAreaView';
import Loading from '../containers/Loading'; import Loading from '../containers/Loading';
import { animateNextTransition } from '../utils/layoutAnimation'; import { animateNextTransition } from '../utils/layoutAnimation';
@ -34,7 +34,7 @@ interface IAddExistingChannelViewState {
interface IAddExistingChannelViewProps { interface IAddExistingChannelViewProps {
navigation: StackNavigationProp<ChatsStackParamList, 'AddExistingChannelView'>; navigation: StackNavigationProp<ChatsStackParamList, 'AddExistingChannelView'>;
route: RouteProp<ChatsStackParamList, 'AddExistingChannelView'>; route: RouteProp<ChatsStackParamList, 'AddExistingChannelView'>;
theme: string; theme: TSupportedThemes;
isMasterDetail: boolean; isMasterDetail: boolean;
addTeamChannelPermission: string[]; addTeamChannelPermission: string[];
} }

View File

@ -13,7 +13,7 @@ import { withSafeAreaInsets } from 'react-native-safe-area-context';
import { LISTENER } from '../containers/Toast'; import { LISTENER } from '../containers/Toast';
import EventEmitter from '../utils/events'; import EventEmitter from '../utils/events';
import I18n from '../i18n'; import I18n from '../i18n';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { ImageViewer } from '../presentation/ImageViewer'; import { ImageViewer } from '../presentation/ImageViewer';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import RCActivityIndicator from '../containers/ActivityIndicator'; import RCActivityIndicator from '../containers/ActivityIndicator';
@ -41,7 +41,7 @@ interface IAttachmentViewState {
interface IAttachmentViewProps { interface IAttachmentViewProps {
navigation: StackNavigationProp<InsideStackParamList, 'AttachmentView'>; navigation: StackNavigationProp<InsideStackParamList, 'AttachmentView'>;
route: RouteProp<InsideStackParamList, 'AttachmentView'>; route: RouteProp<InsideStackParamList, 'AttachmentView'>;
theme: string; theme: TSupportedThemes;
baseUrl: string; baseUrl: string;
width: number; width: number;
height: number; height: number;

View File

@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import I18n from '../i18n'; import I18n from '../i18n';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import sharedStyles from './Styles'; import sharedStyles from './Styles';
@ -23,7 +23,7 @@ const styles = StyleSheet.create({
}); });
interface IAuthLoadingView { interface IAuthLoadingView {
theme: string; theme: TSupportedThemes;
text: string; text: string;
} }

View File

@ -11,7 +11,7 @@ import RocketChat from '../lib/rocketchat';
import { isIOS } from '../utils/deviceInfo'; import { isIOS } from '../utils/deviceInfo';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import ActivityIndicator from '../containers/ActivityIndicator'; import ActivityIndicator from '../containers/ActivityIndicator';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import debounce from '../utils/debounce'; import debounce from '../utils/debounce';
import * as HeaderButton from '../containers/HeaderButton'; import * as HeaderButton from '../containers/HeaderButton';
@ -52,7 +52,7 @@ interface IAuthenticationWebView extends INavigationOption {
server: string; server: string;
Accounts_Iframe_api_url: string; Accounts_Iframe_api_url: string;
Accounts_Iframe_api_method: string; Accounts_Iframe_api_method: string;
theme: string; theme: TSupportedThemes;
} }
interface IState { interface IState {

View File

@ -8,7 +8,7 @@ import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import * as List from '../../containers/List'; import * as List from '../../containers/List';
import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
import { events, logEvent } from '../../utils/log'; import { events, logEvent } from '../../utils/log';
import { ISubscription } from '../../definitions/ISubscription'; import { ISubscription } from '../../definitions/ISubscription';
@ -21,7 +21,7 @@ const styles = StyleSheet.create({
interface IAutoTranslateViewProps { interface IAutoTranslateViewProps {
route: RouteProp<ChatsStackParamList, 'AutoTranslateView'>; route: RouteProp<ChatsStackParamList, 'AutoTranslateView'>;
theme: string; theme: TSupportedThemes;
} }
class AutoTranslateView extends React.Component<IAutoTranslateViewProps, any> { class AutoTranslateView extends React.Component<IAutoTranslateViewProps, any> {

View File

@ -8,7 +8,7 @@ import I18n from '../i18n';
import SafeAreaView from '../containers/SafeAreaView'; import SafeAreaView from '../containers/SafeAreaView';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import Button from '../containers/Button'; import Button from '../containers/Button';
import { useTheme } from '../theme'; import { TSupportedThemes, useTheme } from '../theme';
import RocketChat from '../lib/rocketchat'; import RocketChat from '../lib/rocketchat';
import Navigation from '../lib/navigation/appNavigation'; import Navigation from '../lib/navigation/appNavigation';
import { goRoom } from '../utils/goRoom'; import { goRoom } from '../utils/goRoom';
@ -74,7 +74,7 @@ const styles = StyleSheet.create({
interface IItem { interface IItem {
label: string; label: string;
content?: string; content?: string;
theme: string; theme: TSupportedThemes;
testID?: string; testID?: string;
} }

View File

@ -2,13 +2,14 @@ import React from 'react';
import { View, Text } from 'react-native'; import { View, Text } from 'react-native';
import Touchable from 'react-native-platform-touchable'; import Touchable from 'react-native-platform-touchable';
import { TSupportedThemes } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import Button from '../../containers/Button'; import Button from '../../containers/Button';
import I18n from '../../i18n'; import I18n from '../../i18n';
import styles from './styles'; import styles from './styles';
interface ICannedResponseItem { interface ICannedResponseItem {
theme: string; theme: TSupportedThemes;
onPressDetail: () => void; onPressDetail: () => void;
shortcut: string; shortcut: string;
scope: string; scope: string;

View File

@ -4,7 +4,7 @@ import { withSafeAreaInsets } from 'react-native-safe-area-context';
import styles from '../styles'; import styles from '../styles';
import { themes } from '../../../lib/constants'; import { themes } from '../../../lib/constants';
import { withTheme } from '../../../theme'; import { TSupportedThemes, withTheme } from '../../../theme';
import * as List from '../../../containers/List'; import * as List from '../../../containers/List';
import { IDepartment } from '../../../definitions/ICannedResponse'; import { IDepartment } from '../../../definitions/ICannedResponse';
import DropdownItemFilter from './DropdownItemFilter'; import DropdownItemFilter from './DropdownItemFilter';
@ -14,7 +14,7 @@ import { ROW_HEIGHT } from './DropdownItem';
const ANIMATION_DURATION = 200; const ANIMATION_DURATION = 200;
interface IDropdownProps { interface IDropdownProps {
theme?: string; theme?: TSupportedThemes;
currentDepartment: IDepartment; currentDepartment: IDepartment;
onClose: () => void; onClose: () => void;
onDepartmentSelected: (value: IDepartment) => void; onDepartmentSelected: (value: IDepartment) => void;

View File

@ -1,6 +1,7 @@
import { NewMessageStackParamList } from '../../stacks/types'; import { NewMessageStackParamList } from '../../stacks/types';
import { SubscriptionType } from '../../definitions/ISubscription'; import { SubscriptionType } from '../../definitions/ISubscription';
import { IBaseScreen } from '../../definitions'; import { IBaseScreen } from '../../definitions';
import { TSupportedThemes } from '../../theme';
export interface IResult { export interface IResult {
rid: string; rid: string;
@ -36,7 +37,7 @@ export interface ICreateDiscussionViewSelectChannel {
onChannelSelect: Function; onChannelSelect: Function;
blockUnauthenticatedAccess: boolean; blockUnauthenticatedAccess: boolean;
serverVersion: string; serverVersion: string;
theme: string; theme: TSupportedThemes;
} }
export interface ICreateDiscussionViewSelectUsers { export interface ICreateDiscussionViewSelectUsers {
@ -47,5 +48,5 @@ export interface ICreateDiscussionViewSelectUsers {
onUserSelect: Function; onUserSelect: Function;
blockUnauthenticatedAccess: boolean; blockUnauthenticatedAccess: boolean;
serverVersion: string; serverVersion: string;
theme: string; theme: TSupportedThemes;
} }

View File

@ -3,7 +3,7 @@ import { StackNavigationOptions } from '@react-navigation/stack';
import { FlatList, Linking } from 'react-native'; import { FlatList, Linking } from 'react-native';
import I18n from '../i18n'; import I18n from '../i18n';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import * as List from '../containers/List'; import * as List from '../containers/List';
@ -52,7 +52,7 @@ interface IDefaultBrowserViewState {
} }
interface IDefaultBrowserViewProps { interface IDefaultBrowserViewProps {
theme: string; theme: TSupportedThemes;
} }
class DefaultBrowserView extends React.Component<IDefaultBrowserViewProps, IDefaultBrowserViewState> { class DefaultBrowserView extends React.Component<IDefaultBrowserViewProps, IDefaultBrowserViewState> {

View File

@ -7,6 +7,7 @@ import Check from '../../containers/Check';
import I18n from '../../i18n'; import I18n from '../../i18n';
import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants';
import styles from './styles'; import styles from './styles';
import { TSupportedThemes } from '../../theme';
const ANIMATION_DURATION = 200; const ANIMATION_DURATION = 200;
const ANIMATION_PROPS = { const ANIMATION_PROPS = {
@ -22,7 +23,7 @@ interface IDirectoryOptionsProps {
close: Function; close: Function;
changeType: Function; changeType: Function;
toggleWorkspace(): void; toggleWorkspace(): void;
theme: string; theme: TSupportedThemes;
} }
export default class DirectoryOptions extends PureComponent<IDirectoryOptionsProps, any> { export default class DirectoryOptions extends PureComponent<IDirectoryOptionsProps, any> {

View File

@ -17,7 +17,7 @@ import ActivityIndicator from '../../containers/ActivityIndicator';
import * as HeaderButton from '../../containers/HeaderButton'; import * as HeaderButton from '../../containers/HeaderButton';
import debounce from '../../utils/debounce'; import debounce from '../../utils/debounce';
import log, { events, logEvent } from '../../utils/log'; import log, { events, logEvent } from '../../utils/log';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -33,7 +33,7 @@ interface IDirectoryViewProps {
id: string; id: string;
token: string; token: string;
}; };
theme: string; theme: TSupportedThemes;
directoryDefaultView: string; directoryDefaultView: string;
isMasterDetail: boolean; isMasterDetail: boolean;
} }

View File

@ -8,7 +8,7 @@ import StatusBar from '../containers/StatusBar';
import * as List from '../containers/List'; import * as List from '../containers/List';
import I18n from '../i18n'; import I18n from '../i18n';
import log, { events, logEvent } from '../utils/log'; import log, { events, logEvent } from '../utils/log';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import SafeAreaView from '../containers/SafeAreaView'; import SafeAreaView from '../containers/SafeAreaView';
import TextInput from '../containers/TextInput'; import TextInput from '../containers/TextInput';
import Button from '../containers/Button'; import Button from '../containers/Button';
@ -48,7 +48,7 @@ interface IE2EEncryptionSecurityViewState {
} }
interface IE2EEncryptionSecurityViewProps { interface IE2EEncryptionSecurityViewProps {
theme: string; theme?: TSupportedThemes;
user: IUser; user: IUser;
server: string; server: string;
encryptionEnabled: boolean; encryptionEnabled: boolean;
@ -127,10 +127,10 @@ class E2EEncryptionSecurityView extends React.Component<IE2EEncryptionSecurityVi
return ( return (
<> <>
<List.Section> <List.Section>
<Text style={[styles.title, { color: themes[theme].titleColor }]}> <Text style={[styles.title, { color: themes[theme!].headerTitleColor }]}>
{I18n.t('E2E_encryption_change_password_title')} {I18n.t('E2E_encryption_change_password_title')}
</Text> </Text>
<Text style={[styles.description, { color: themes[theme].bodyText }]}> <Text style={[styles.description, { color: themes[theme!].bodyText }]}>
{I18n.t('E2E_encryption_change_password_description')} {I18n.t('E2E_encryption_change_password_description')}
</Text> </Text>
<TextInput <TextInput
@ -161,15 +161,17 @@ class E2EEncryptionSecurityView extends React.Component<IE2EEncryptionSecurityVi
render() { render() {
const { theme } = this.props; const { theme } = this.props;
return ( return (
<SafeAreaView testID='e2e-encryption-security-view' style={{ backgroundColor: themes[theme].backgroundColor }}> <SafeAreaView testID='e2e-encryption-security-view' style={{ backgroundColor: themes[theme!].backgroundColor }}>
<StatusBar /> <StatusBar />
<List.Container> <List.Container>
<View style={styles.container}> <View style={styles.container}>
{this.renderChangePassword()} {this.renderChangePassword()}
<List.Section> <List.Section>
<Text style={[styles.title, { color: themes[theme].titleColor }]}>{I18n.t('E2E_encryption_reset_title')}</Text> <Text style={[styles.title, { color: themes[theme!].headerTitleColor }]}>
<Text style={[styles.description, { color: themes[theme].bodyText }]}> {I18n.t('E2E_encryption_reset_title')}
</Text>
<Text style={[styles.description, { color: themes[theme!].bodyText }]}>
{I18n.t('E2E_encryption_reset_description')} {I18n.t('E2E_encryption_reset_description')}
</Text> </Text>
<Button <Button
@ -177,7 +179,7 @@ class E2EEncryptionSecurityView extends React.Component<IE2EEncryptionSecurityVi
title={I18n.t('E2E_encryption_reset_button')} title={I18n.t('E2E_encryption_reset_button')}
theme={theme} theme={theme}
type='secondary' type='secondary'
backgroundColor={themes[theme].chatComponentBackground} backgroundColor={themes[theme!].chatComponentBackground}
testID='e2e-encryption-security-view-reset-key' testID='e2e-encryption-security-view-reset-key'
/> />
</List.Section> </List.Section>

View File

@ -7,7 +7,7 @@ import SafeAreaView from '../containers/SafeAreaView';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import * as HeaderButton from '../containers/HeaderButton'; import * as HeaderButton from '../containers/HeaderButton';
import Markdown from '../containers/markdown'; import Markdown from '../containers/markdown';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import I18n from '../i18n'; import I18n from '../i18n';
import { E2ESaveYourPasswordStackParamList } from '../stacks/types'; import { E2ESaveYourPasswordStackParamList } from '../stacks/types';
@ -29,7 +29,7 @@ interface INavigation {
} }
interface IE2EHowItWorksViewProps extends INavigation { interface IE2EHowItWorksViewProps extends INavigation {
theme: string; theme: TSupportedThemes;
} }
class E2EHowItWorksView extends React.Component<IE2EHowItWorksViewProps, any> { class E2EHowItWorksView extends React.Component<IE2EHowItWorksViewProps, any> {

View File

@ -9,7 +9,7 @@ import { showErrorAlert } from '../utils/info';
import isValidEmail from '../utils/isValidEmail'; import isValidEmail from '../utils/isValidEmail';
import I18n from '../i18n'; import I18n from '../i18n';
import RocketChat from '../lib/rocketchat'; import RocketChat from '../lib/rocketchat';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import FormContainer, { FormContainerInner } from '../containers/FormContainer'; import FormContainer, { FormContainerInner } from '../containers/FormContainer';
import { events, logEvent } from '../utils/log'; import { events, logEvent } from '../utils/log';
@ -25,7 +25,7 @@ interface IForgotPasswordViewState {
interface IForgotPasswordViewProps { interface IForgotPasswordViewProps {
navigation: StackNavigationProp<OutsideParamList, 'ForgotPasswordView'>; navigation: StackNavigationProp<OutsideParamList, 'ForgotPasswordView'>;
route: RouteProp<OutsideParamList, 'ForgotPasswordView'>; route: RouteProp<OutsideParamList, 'ForgotPasswordView'>;
theme: string; theme: TSupportedThemes;
} }
class ForgotPasswordView extends React.Component<IForgotPasswordViewProps, IForgotPasswordViewState> { class ForgotPasswordView extends React.Component<IForgotPasswordViewProps, IForgotPasswordViewState> {

View File

@ -11,7 +11,7 @@ import { getUserSelector } from '../selectors/login';
import ActivityIndicator from '../containers/ActivityIndicator'; import ActivityIndicator from '../containers/ActivityIndicator';
import { events, logEvent } from '../utils/log'; import { events, logEvent } from '../utils/log';
import { isAndroid, isIOS } from '../utils/deviceInfo'; import { isAndroid, isIOS } from '../utils/deviceInfo';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { InsideStackParamList } from '../stacks/types'; import { InsideStackParamList } from '../stacks/types';
import { IApplicationState, IUser } from '../definitions'; import { IApplicationState, IUser } from '../definitions';
@ -30,7 +30,7 @@ interface IJitsiMeetViewProps {
navigation: StackNavigationProp<InsideStackParamList, 'JitsiMeetView'>; navigation: StackNavigationProp<InsideStackParamList, 'JitsiMeetView'>;
route: RouteProp<InsideStackParamList, 'JitsiMeetView'>; route: RouteProp<InsideStackParamList, 'JitsiMeetView'>;
baseUrl: string; baseUrl: string;
theme: string; theme: TSupportedThemes;
user: IUser; user: IUser;
} }

View File

@ -5,13 +5,13 @@ import { StackNavigationOptions } from '@react-navigation/stack';
import I18n from '../i18n'; import I18n from '../i18n';
import StatusBar from '../containers/StatusBar'; import StatusBar from '../containers/StatusBar';
import openLink from '../utils/openLink'; import openLink from '../utils/openLink';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import SafeAreaView from '../containers/SafeAreaView'; import SafeAreaView from '../containers/SafeAreaView';
import * as List from '../containers/List'; import * as List from '../containers/List';
interface ILegalView { interface ILegalView {
server: string; server: string;
theme: string; theme: TSupportedThemes;
} }
class LegalView extends React.Component<ILegalView, any> { class LegalView extends React.Component<ILegalView, any> {

View File

@ -5,7 +5,7 @@ import { ScrollView, StyleSheet, Text } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit'; import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import TextInput from '../containers/TextInput'; import TextInput from '../containers/TextInput';
import KeyboardView from '../presentation/KeyboardView'; import KeyboardView from '../presentation/KeyboardView';
@ -47,7 +47,7 @@ interface ILivechatEditViewProps {
user: any; user: any;
navigation: StackNavigationProp<ChatsStackParamList, 'LivechatEditView'>; navigation: StackNavigationProp<ChatsStackParamList, 'LivechatEditView'>;
route: RouteProp<ChatsStackParamList, 'LivechatEditView'>; route: RouteProp<ChatsStackParamList, 'LivechatEditView'>;
theme: string; theme: TSupportedThemes;
editOmnichannelContact: string[] | undefined; editOmnichannelContact: string[] | undefined;
editLivechatRoomCustomfields: string[] | undefined; editLivechatRoomCustomfields: string[] | undefined;
} }

View File

@ -6,12 +6,12 @@ import { RouteProp } from '@react-navigation/native';
import I18n from '../i18n'; import I18n from '../i18n';
import { isIOS } from '../utils/deviceInfo'; import { isIOS } from '../utils/deviceInfo';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { ChatsStackParamList } from '../stacks/types'; import { ChatsStackParamList } from '../stacks/types';
interface IMarkdownTableViewProps { interface IMarkdownTableViewProps {
route: RouteProp<ChatsStackParamList, 'MarkdownTableView'>; route: RouteProp<ChatsStackParamList, 'MarkdownTableView'>;
theme: string; theme: TSupportedThemes;
} }
class MarkdownTableView extends React.Component<IMarkdownTableViewProps> { class MarkdownTableView extends React.Component<IMarkdownTableViewProps> {

View File

@ -13,7 +13,7 @@ import RocketChat from '../../lib/rocketchat';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import getFileUrlFromMessage from '../../lib/methods/helpers/getFileUrlFromMessage'; import getFileUrlFromMessage from '../../lib/methods/helpers/getFileUrlFromMessage';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import { withActionSheet } from '../../containers/ActionSheet'; import { withActionSheet } from '../../containers/ActionSheet';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -38,7 +38,7 @@ interface IMessagesViewProps {
>; >;
route: RouteProp<ChatsStackParamList, 'MessagesView'>; route: RouteProp<ChatsStackParamList, 'MessagesView'>;
customEmojis: { [key: string]: IEmoji }; customEmojis: { [key: string]: IEmoji };
theme: string; theme: TSupportedThemes;
showActionSheet: Function; showActionSheet: Function;
useRealName: boolean; useRealName: boolean;
isMasterDetail: boolean; isMasterDetail: boolean;

View File

@ -5,7 +5,7 @@ import { RouteProp } from '@react-navigation/native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { KeyboardAwareScrollView } from '@codler/react-native-keyboard-aware-scroll-view'; import { KeyboardAwareScrollView } from '@codler/react-native-keyboard-aware-scroll-view';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import EventEmitter from '../utils/events'; import EventEmitter from '../utils/events';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import * as HeaderButton from '../containers/HeaderButton'; import * as HeaderButton from '../containers/HeaderButton';
@ -53,7 +53,7 @@ interface IModalBlockViewState {
interface IModalBlockViewProps { interface IModalBlockViewProps {
navigation: StackNavigationProp<MasterDetailInsideStackParamList, 'ModalBlockView'>; navigation: StackNavigationProp<MasterDetailInsideStackParamList, 'ModalBlockView'>;
route: RouteProp<MasterDetailInsideStackParamList, 'ModalBlockView'>; route: RouteProp<MasterDetailInsideStackParamList, 'ModalBlockView'>;
theme: string; theme: TSupportedThemes;
language: string; language: string;
user: { user: {
id: string; id: string;

View File

@ -7,6 +7,7 @@ import { CustomIcon } from '../../../lib/Icons';
import sharedStyles from '../../Styles'; import sharedStyles from '../../Styles';
import Touch from '../../../utils/touch'; import Touch from '../../../utils/touch';
import { TServerHistoryModel } from '../../../definitions/IServerHistory'; import { TServerHistoryModel } from '../../../definitions/IServerHistory';
import { TSupportedThemes } from '../../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -29,7 +30,7 @@ const styles = StyleSheet.create({
interface IItem { interface IItem {
item: TServerHistoryModel; item: TServerHistoryModel;
theme: string; theme: TSupportedThemes;
onPress(url: string): void; onPress(url: string): void;
onDelete(item: TServerHistoryModel): void; onDelete(item: TServerHistoryModel): void;
} }

View File

@ -7,6 +7,7 @@ import { themes } from '../../../lib/constants';
import I18n from '../../../i18n'; import I18n from '../../../i18n';
import { TServerHistoryModel } from '../../../definitions/IServerHistory'; import { TServerHistoryModel } from '../../../definitions/IServerHistory';
import Item from './Item'; import Item from './Item';
import { TSupportedThemes } from '../../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -30,7 +31,7 @@ const styles = StyleSheet.create({
interface IServerInput extends TextInputProps { interface IServerInput extends TextInputProps {
text: string; text: string;
theme: string; theme: TSupportedThemes;
serversHistory: any[]; serversHistory: any[];
onSubmit(): void; onSubmit(): void;
onDelete(item: TServerHistoryModel): void; onDelete(item: TServerHistoryModel): void;

View File

@ -11,7 +11,7 @@ import StatusBar from '../../containers/StatusBar';
import * as List from '../../containers/List'; import * as List from '../../containers/List';
import I18n from '../../i18n'; import I18n from '../../i18n';
import RocketChat from '../../lib/rocketchat'; import RocketChat from '../../lib/rocketchat';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import protectedFunction from '../../lib/methods/helpers/protectedFunction'; import protectedFunction from '../../lib/methods/helpers/protectedFunction';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
import log, { events, logEvent } from '../../utils/log'; import log, { events, logEvent } from '../../utils/log';
@ -30,7 +30,7 @@ const styles = StyleSheet.create({
interface INotificationPreferencesView { interface INotificationPreferencesView {
navigation: StackNavigationProp<ChatsStackParamList, 'NotificationPrefView'>; navigation: StackNavigationProp<ChatsStackParamList, 'NotificationPrefView'>;
route: RouteProp<ChatsStackParamList, 'NotificationPrefView'>; route: RouteProp<ChatsStackParamList, 'NotificationPrefView'>;
theme: string; theme: TSupportedThemes;
} }
class NotificationPreferencesView extends React.Component<INotificationPreferencesView, any> { class NotificationPreferencesView extends React.Component<INotificationPreferencesView, any> {

View File

@ -4,7 +4,7 @@ import { RouteProp } from '@react-navigation/native';
import { FlatList, StyleSheet, Text, View } from 'react-native'; import { FlatList, StyleSheet, Text, View } from 'react-native';
import I18n from '../i18n'; import I18n from '../i18n';
import { withTheme } from '../theme'; import { TSupportedThemes, withTheme } from '../theme';
import { themes } from '../lib/constants'; import { themes } from '../lib/constants';
import debounce from '../utils/debounce'; import debounce from '../utils/debounce';
import * as List from '../containers/List'; import * as List from '../containers/List';
@ -34,7 +34,7 @@ interface IItem {
item: IOptionsField; item: IOptionsField;
selected: boolean; selected: boolean;
onItemPress: () => void; onItemPress: () => void;
theme: string; theme: TSupportedThemes;
} }
interface IRenderSearch { interface IRenderSearch {
@ -52,7 +52,7 @@ interface IPickerViewState {
interface IPickerViewProps { interface IPickerViewProps {
navigation: StackNavigationProp<ChatsStackParamList, 'PickerView'>; navigation: StackNavigationProp<ChatsStackParamList, 'PickerView'>;
route: RouteProp<ChatsStackParamList, 'PickerView'>; route: RouteProp<ChatsStackParamList, 'PickerView'>;
theme: string; theme: TSupportedThemes;
} }
const Item = React.memo(({ item, selected, onItemPress, theme }: IItem) => ( const Item = React.memo(({ item, selected, onItemPress, theme }: IItem) => (

View File

@ -12,7 +12,7 @@ import * as HeaderButton from '../../containers/HeaderButton';
import I18n from '../../i18n'; import I18n from '../../i18n';
import RocketChat from '../../lib/rocketchat'; import RocketChat from '../../lib/rocketchat';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
import styles from './styles'; import styles from './styles';
@ -32,7 +32,7 @@ interface INavigationOption {
interface IReadReceiptViewProps extends INavigationOption { interface IReadReceiptViewProps extends INavigationOption {
Message_TimeAndDateFormat: string; Message_TimeAndDateFormat: string;
theme: string; theme: TSupportedThemes;
} }
class ReadReceiptView extends React.Component<IReadReceiptViewProps, IReadReceiptViewState> { class ReadReceiptView extends React.Component<IReadReceiptViewProps, IReadReceiptViewState> {

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import { Switch, Text, TextStyle, View, ViewStyle } from 'react-native'; import { Switch, Text, TextStyle, View, ViewStyle } from 'react-native';
import { TSupportedThemes } from '../../theme';
import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants'; import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants';
import styles from './styles'; import styles from './styles';
@ -12,7 +13,7 @@ interface ISwitchContainer {
rightLabelPrimary?: string; rightLabelPrimary?: string;
rightLabelSecondary?: string; rightLabelSecondary?: string;
onValueChange: (value: any) => void; onValueChange: (value: any) => void;
theme: string; theme: TSupportedThemes;
testID: string; testID: string;
labelContainerStyle?: ViewStyle; labelContainerStyle?: ViewStyle;
leftLabelStyle?: TextStyle; leftLabelStyle?: TextStyle;

View File

@ -26,7 +26,7 @@ import KeyboardView from '../../presentation/KeyboardView';
import { TSupportedPermissions } from '../../reducers/permissions'; import { TSupportedPermissions } from '../../reducers/permissions';
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types'; import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
import { ChatsStackParamList } from '../../stacks/types'; import { ChatsStackParamList } from '../../stacks/types';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import EventEmitter from '../../utils/events'; import EventEmitter from '../../utils/events';
import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
import log, { events, logEvent } from '../../utils/log'; import log, { events, logEvent } from '../../utils/log';
@ -62,7 +62,7 @@ interface IRoomInfoEditViewState {
interface IRoomInfoEditViewProps extends IBaseScreen<ChatsStackParamList | ModalStackParamList, 'RoomInfoEditView'> { interface IRoomInfoEditViewProps extends IBaseScreen<ChatsStackParamList | ModalStackParamList, 'RoomInfoEditView'> {
serverVersion?: string; serverVersion?: string;
encryptionEnabled: boolean; encryptionEnabled: boolean;
theme: string; theme: TSupportedThemes;
setReadOnlyPermission: string[]; setReadOnlyPermission: string[];
setReactWhenReadOnlyPermission: string[]; setReactWhenReadOnlyPermission: string[];
archiveRoomPermission: string[]; archiveRoomPermission: string[];

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { StyleSheet, Text } from 'react-native'; import { StyleSheet, Text } from 'react-native';
import RocketChat from '../../lib/rocketchat'; import RocketChat from '../../lib/rocketchat';
import { useTheme } from '../../theme'; import { TSupportedThemes, useTheme } from '../../theme';
import sharedStyles from '../Styles'; import sharedStyles from '../Styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import I18n from '../../i18n'; import I18n from '../../i18n';
@ -21,7 +21,7 @@ const styles = StyleSheet.create({
} }
}); });
const Title = ({ title, theme }: { title: string; theme: string }) => ( const Title = ({ title, theme }: { title: string; theme: TSupportedThemes }) => (
<Text style={[styles.title, { color: themes[theme].titleText }]}>{title}</Text> <Text style={[styles.title, { color: themes[theme].titleText }]}>{title}</Text>
); );

View File

@ -19,7 +19,7 @@ import * as HeaderButton from '../../containers/HeaderButton';
import StatusBar from '../../containers/StatusBar'; import StatusBar from '../../containers/StatusBar';
import log, { events, logEvent } from '../../utils/log'; import log, { events, logEvent } from '../../utils/log';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import { MarkdownPreview } from '../../containers/markdown'; import { MarkdownPreview } from '../../containers/markdown';
import { LISTENER } from '../../containers/Toast'; import { LISTENER } from '../../containers/Toast';
import EventEmitter from '../../utils/events'; import EventEmitter from '../../utils/events';
@ -41,7 +41,7 @@ interface IGetRoomTitle {
name?: string; name?: string;
username: string; username: string;
statusText?: string; statusText?: string;
theme: string; theme: TSupportedThemes;
} }
const getRoomTitle = ({ room, type, name, username, statusText, theme }: IGetRoomTitle) => const getRoomTitle = ({ room, type, name, username, statusText, theme }: IGetRoomTitle) =>
@ -82,7 +82,7 @@ interface IRoomInfoViewProps {
>; >;
route: RouteProp<ChatsStackParamList, 'RoomInfoView'>; route: RouteProp<ChatsStackParamList, 'RoomInfoView'>;
rooms: string[]; rooms: string[];
theme: string; theme: TSupportedThemes;
isMasterDetail: boolean; isMasterDetail: boolean;
jitsiEnabled: boolean; jitsiEnabled: boolean;
editRoomPermission?: string[]; editRoomPermission?: string[];

View File

@ -22,7 +22,7 @@ import RocketChat from '../../lib/rocketchat';
import UserItem from '../../containers/UserItem'; import UserItem from '../../containers/UserItem';
import { getUserSelector } from '../../selectors/login'; import { getUserSelector } from '../../selectors/login';
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types'; import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
import { withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import EventEmitter from '../../utils/events'; import EventEmitter from '../../utils/events';
import { goRoom, TGoRoomItem } from '../../utils/goRoom'; import { goRoom, TGoRoomItem } from '../../utils/goRoom';
import { showConfirmationAlert, showErrorAlert } from '../../utils/info'; import { showConfirmationAlert, showErrorAlert } from '../../utils/info';
@ -44,7 +44,7 @@ interface IRoomMembersViewProps extends IBaseScreen<ModalStackParamList, 'RoomMe
roles: string[]; roles: string[];
}; };
showActionSheet: (params: any) => {}; // TODO: this work? showActionSheet: (params: any) => {}; // TODO: this work?
theme: string; theme: TSupportedThemes;
isMasterDetail: boolean; isMasterDetail: boolean;
useRealName: boolean; useRealName: boolean;
muteUserPermission: string[]; muteUserPermission: string[];

View File

@ -10,6 +10,7 @@ import RocketChat from '../../lib/rocketchat';
import sharedStyles from '../Styles'; import sharedStyles from '../Styles';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { IApplicationState } from '../../definitions'; import { IApplicationState } from '../../definitions';
import { TSupportedThemes } from '../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
@ -46,7 +47,7 @@ export interface IJoinCodeProps {
t: string; t: string;
onJoin: Function; onJoin: Function;
isMasterDetail: boolean; isMasterDetail: boolean;
theme: string; theme: TSupportedThemes;
} }
const JoinCode = React.memo( const JoinCode = React.memo(

View File

@ -5,6 +5,7 @@ import { HeaderBackButton, StackNavigationProp } from '@react-navigation/stack';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import Avatar from '../../containers/Avatar'; import Avatar from '../../containers/Avatar';
import { ChatsStackParamList } from '../../stacks/types'; import { ChatsStackParamList } from '../../stacks/types';
import { TSupportedThemes } from '../../theme';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
avatar: { avatar: {
@ -22,7 +23,7 @@ interface ILeftButtonsProps {
token?: string; token?: string;
title?: string; title?: string;
t: string; t: string;
theme: string; theme: TSupportedThemes;
goRoomActionsView: Function; goRoomActionsView: Function;
isMasterDetail: boolean; isMasterDetail: boolean;
} }

View File

@ -6,6 +6,7 @@ import { FlatListProps, RefreshControl, ViewToken } from 'react-native';
import { event, Value } from 'react-native-reanimated'; import { event, Value } from 'react-native-reanimated';
import { Observable, Subscription } from 'rxjs'; import { Observable, Subscription } from 'rxjs';
import { TSupportedThemes } from '../../../theme';
import { themes } from '../../../lib/constants'; import { themes } from '../../../lib/constants';
import ActivityIndicator from '../../../containers/ActivityIndicator'; import ActivityIndicator from '../../../containers/ActivityIndicator';
import { TAnyMessageModel, TMessageModel, TThreadMessageModel, TThreadModel } from '../../../definitions'; import { TAnyMessageModel, TMessageModel, TThreadMessageModel, TThreadModel } from '../../../definitions';
@ -39,7 +40,7 @@ export interface IListContainerProps {
renderRow: Function; renderRow: Function;
rid: string; rid: string;
tmid?: string; tmid?: string;
theme: string; theme: TSupportedThemes;
loading: boolean; loading: boolean;
listRef: React.RefObject<IListProps>; listRef: React.RefObject<IListProps>;
hideSystemMessages?: string[]; hideSystemMessages?: string[];

Some files were not shown because too many files have changed in this diff Show More