diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap
index 9d9a30e3..b30a37fe 100644
--- a/__tests__/__snapshots__/Storyshots.test.js.snap
+++ b/__tests__/__snapshots__/Storyshots.test.js.snap
@@ -6796,7 +6796,7 @@ exports[`Storyshots List with black theme 1`] = `
`;
-exports[`Storyshots List with custom color 1`] = `
+exports[`Storyshots List with custom colors 1`] = `
+
+
+
+ Press me!
+
+
+
+
`;
diff --git a/app/constants/colors.js b/app/constants/colors.js
index 6cc0ea16..b1fdcd7f 100644
--- a/app/constants/colors.js
+++ b/app/constants/colors.js
@@ -35,6 +35,7 @@ export const themes = {
auxiliaryText: '#9ca2a8',
infoText: '#6d6d72',
tintColor: '#1d74f5',
+ tintActive: '#549df9',
auxiliaryTintColor: '#6C727A',
actionTintColor: '#1d74f5',
separatorColor: '#cbcbcc',
@@ -80,6 +81,7 @@ export const themes = {
auxiliaryText: '#9297a2',
infoText: '#6D6D72',
tintColor: '#1d74f5',
+ tintActive: '#549df9',
auxiliaryTintColor: '#f9f9f9',
actionTintColor: '#1d74f5',
separatorColor: '#2b2b2d',
@@ -125,6 +127,7 @@ export const themes = {
auxiliaryText: '#b2b8c6',
infoText: '#6d6d72',
tintColor: '#1e9bfe',
+ tintActive: '#76b7fc',
auxiliaryTintColor: '#f9f9f9',
actionTintColor: '#1e9bfe',
separatorColor: '#272728',
diff --git a/app/containers/List/ListItem.js b/app/containers/List/ListItem.js
index a3252a7f..6ce7bb6f 100644
--- a/app/containers/List/ListItem.js
+++ b/app/containers/List/ListItem.js
@@ -1,9 +1,6 @@
import React from 'react';
import {
- View,
- Text,
- StyleSheet,
- I18nManager
+ View, Text, StyleSheet, I18nManager
} from 'react-native';
import PropTypes from 'prop-types';
@@ -82,11 +79,12 @@ const Content = React.memo(({
));
const Button = React.memo(({
- onPress, ...props
+ onPress, backgroundColor, underlayColor, ...props
}) => (
onPress(props.title)}
- style={{ backgroundColor: themes[props.theme].backgroundColor }}
+ style={{ backgroundColor: backgroundColor || themes[props.theme].backgroundColor }}
+ underlayColor={underlayColor}
enabled={!props.disabled}
theme={props.theme}
>
@@ -99,7 +97,7 @@ const ListItem = React.memo(({ ...props }) => {
return ;
}
return (
-
+
);
@@ -107,7 +105,8 @@ const ListItem = React.memo(({ ...props }) => {
ListItem.propTypes = {
onPress: PropTypes.func,
- theme: PropTypes.string
+ theme: PropTypes.string,
+ backgroundColor: PropTypes.string
};
ListItem.displayName = 'List.Item';
@@ -137,7 +136,9 @@ Button.propTypes = {
title: PropTypes.string,
onPress: PropTypes.func,
disabled: PropTypes.bool,
- theme: PropTypes.string
+ theme: PropTypes.string,
+ backgroundColor: PropTypes.string,
+ underlayColor: PropTypes.string
};
Button.defaultProps = {
diff --git a/app/ee/omnichannel/containers/OmnichannelStatus.js b/app/ee/omnichannel/containers/OmnichannelStatus.js
index 7ae99a61..148f398c 100644
--- a/app/ee/omnichannel/containers/OmnichannelStatus.js
+++ b/app/ee/omnichannel/containers/OmnichannelStatus.js
@@ -1,12 +1,8 @@
import React, { memo, useState, useEffect } from 'react';
-import {
- View, Text, StyleSheet, Switch
-} from 'react-native';
+import { View, Switch } from 'react-native';
import PropTypes from 'prop-types';
-import Touch from '../../../utils/touch';
-import { CustomIcon } from '../../../lib/Icons';
-import I18n from '../../../i18n';
+import * as List from '../../../containers/List';
import styles from '../../../views/RoomsListView/styles';
import { themes, SWITCH_TRACK_COLOR } from '../../../constants/colors';
import { withTheme } from '../../../theme';
@@ -36,35 +32,32 @@ const OmnichannelStatus = memo(({
};
return (
-
-
-
- {I18n.t('Omnichannel')}
- {inquiryEnabled
- ? (
-
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={goQueue}
+ right={() => (
+
+ {inquiryEnabled
+ ? (
+
+ )
+ : null}
+
- )
- : null}
-
-
-
+
+ )}
+ />
+
+ >
);
});
diff --git a/app/utils/touch.js b/app/utils/touch.js
index 505e6a02..d5c22d4d 100644
--- a/app/utils/touch.js
+++ b/app/utils/touch.js
@@ -15,7 +15,7 @@ class Touch extends React.Component {
render() {
const {
- children, onPress, theme, ...props
+ children, onPress, theme, underlayColor, ...props
} = this.props;
return (
@@ -23,7 +23,7 @@ class Touch extends React.Component {
ref={this.getRef}
onPress={onPress}
activeOpacity={1}
- underlayColor={themes[theme].bannerBackground}
+ underlayColor={underlayColor || themes[theme].bannerBackground}
rippleColor={themes[theme].bannerBackground}
{...props}
>
@@ -36,7 +36,8 @@ class Touch extends React.Component {
Touch.propTypes = {
children: PropTypes.node,
onPress: PropTypes.func,
- theme: PropTypes.string
+ theme: PropTypes.string,
+ underlayColor: PropTypes.string
};
export default Touch;
diff --git a/app/views/RoomsListView/ListHeader/Encryption.js b/app/views/RoomsListView/ListHeader/Encryption.js
deleted file mode 100644
index b666f487..00000000
--- a/app/views/RoomsListView/ListHeader/Encryption.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import React from 'react';
-import { Text } from 'react-native';
-import PropTypes from 'prop-types';
-import { BorderlessButton } from 'react-native-gesture-handler';
-
-import { withTheme } from '../../../theme';
-import { CustomIcon } from '../../../lib/Icons';
-import { themes } from '../../../constants/colors';
-import I18n from '../../../i18n';
-import styles from '../styles';
-import { E2E_BANNER_TYPE } from '../../../lib/encryption/constants';
-
-const Encryption = React.memo(({
- searching,
- goEncryption,
- encryptionBanner,
- theme
-}) => {
- if (searching > 0 || !encryptionBanner) {
- return null;
- }
-
- let text = I18n.t('Save_Your_Encryption_Password');
- if (encryptionBanner === E2E_BANNER_TYPE.REQUEST_PASSWORD) {
- text = I18n.t('Enter_Your_E2E_Password');
- }
-
- return (
-
-
- {text}
-
- );
-});
-
-Encryption.propTypes = {
- searching: PropTypes.bool,
- goEncryption: PropTypes.func,
- encryptionBanner: PropTypes.string,
- theme: PropTypes.string
-};
-
-export default withTheme(Encryption);
diff --git a/app/views/RoomsListView/ListHeader/Sort.js b/app/views/RoomsListView/ListHeader/Sort.js
deleted file mode 100644
index 972b2980..00000000
--- a/app/views/RoomsListView/ListHeader/Sort.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import React from 'react';
-import { View, Text, StyleSheet } from 'react-native';
-import PropTypes from 'prop-types';
-
-import Touch from '../../../utils/touch';
-import { CustomIcon } from '../../../lib/Icons';
-import I18n from '../../../i18n';
-import styles from '../styles';
-import { themes } from '../../../constants/colors';
-import { withTheme } from '../../../theme';
-
-
-const Sort = React.memo(({
- searching, sortBy, toggleSort, theme
-}) => {
- if (searching > 0) {
- return null;
- }
- return (
-
-
-
- {I18n.t('Sorting_by', { key: I18n.t(sortBy === 'alphabetical' ? 'name' : 'activity') })}
-
-
- );
-});
-
-Sort.propTypes = {
- searching: PropTypes.bool,
- sortBy: PropTypes.string,
- theme: PropTypes.string,
- toggleSort: PropTypes.func
-};
-
-export default withTheme(Sort);
diff --git a/app/views/RoomsListView/ListHeader/index.js b/app/views/RoomsListView/ListHeader/index.js
index aa437273..85ffcfa9 100644
--- a/app/views/RoomsListView/ListHeader/index.js
+++ b/app/views/RoomsListView/ListHeader/index.js
@@ -1,8 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';
-import Sort from './Sort';
-import Encryption from './Encryption';
+import { withTheme } from '../../../theme';
+import I18n from '../../../i18n';
+import * as List from '../../../containers/List';
+import { E2E_BANNER_TYPE } from '../../../lib/encryption/constants';
+import { themes } from '../../../constants/colors';
import OmnichannelStatus from '../../../ee/omnichannel/containers/OmnichannelStatus';
@@ -15,14 +18,55 @@ const ListHeader = React.memo(({
queueSize,
inquiryEnabled,
encryptionBanner,
- user
-}) => (
- <>
-
-
-
- >
-));
+ user,
+ theme
+}) => {
+ const sortTitle = I18n.t('Sorting_by', { key: I18n.t(sortBy === 'alphabetical' ? 'name' : 'activity') });
+
+ if (searching) {
+ return null;
+ }
+
+ return (
+ <>
+ {encryptionBanner
+ ? (
+ <>
+ }
+ underlayColor={themes[theme].tintActive}
+ backgroundColor={themes[theme].actionTintColor}
+ color={themes[theme].buttonText}
+ onPress={goEncryption}
+ testID='listheader-encryption'
+ />
+
+ >
+ )
+ : null}
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={toggleSort}
+ translateTitle={false}
+ />
+
+
+ >
+ );
+});
ListHeader.propTypes = {
searching: PropTypes.bool,
@@ -33,7 +77,8 @@ ListHeader.propTypes = {
queueSize: PropTypes.number,
inquiryEnabled: PropTypes.bool,
encryptionBanner: PropTypes.string,
- user: PropTypes.object
+ user: PropTypes.object,
+ theme: PropTypes.string
};
-export default ListHeader;
+export default withTheme(ListHeader);
diff --git a/app/views/RoomsListView/SortDropdown/Item.js b/app/views/RoomsListView/SortDropdown/Item.js
deleted file mode 100644
index b842b3f7..00000000
--- a/app/views/RoomsListView/SortDropdown/Item.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import React from 'react';
-import { View, Text, Image } from 'react-native';
-import PropTypes from 'prop-types';
-
-import styles from '../styles';
-import Touch from '../../../utils/touch';
-import I18n from '../../../i18n';
-import { CustomIcon } from '../../../lib/Icons';
-import Check from '../../../containers/Check';
-import { themes } from '../../../constants/colors';
-
-
-export const SortItemButton = ({ children, onPress, theme }) => (
-
- {children}
-
-);
-
-SortItemButton.propTypes = {
- theme: PropTypes.string,
- children: PropTypes.node,
- onPress: PropTypes.func
-};
-
-export const SortItemContent = ({
- label, icon, imageUri, checked, theme
-}) => (
-
- {icon && }
- {imageUri && }
- {I18n.t(label)}
- {checked ? : null}
-
-);
-
-SortItemContent.propTypes = {
- theme: PropTypes.string,
- label: PropTypes.string,
- icon: PropTypes.string,
- imageUri: PropTypes.string,
- checked: PropTypes.bool
-};
diff --git a/app/views/RoomsListView/SortDropdown/index.js b/app/views/RoomsListView/SortDropdown/index.js
index 536f5738..cb85edcd 100644
--- a/app/views/RoomsListView/SortDropdown/index.js
+++ b/app/views/RoomsListView/SortDropdown/index.js
@@ -1,21 +1,19 @@
import React, { PureComponent } from 'react';
import {
- View, Text, Animated, Easing, TouchableWithoutFeedback
+ Animated, Easing, TouchableWithoutFeedback
} from 'react-native';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withSafeAreaInsets } from 'react-native-safe-area-context';
import styles from '../styles';
-import Touch from '../../../utils/touch';
+import * as List from '../../../containers/List';
import RocketChat from '../../../lib/rocketchat';
import { setPreference } from '../../../actions/sortPreferences';
import log, { logEvent, events } from '../../../utils/log';
import I18n from '../../../i18n';
-import { CustomIcon } from '../../../lib/Icons';
import { withTheme } from '../../../theme';
import { themes } from '../../../constants/colors';
-import { SortItemButton, SortItemContent } from './Item';
import { headerHeight } from '../../../containers/Header';
const ANIMATION_DURATION = 200;
@@ -113,6 +111,11 @@ class Sort extends PureComponent {
).start(() => close());
}
+ renderCheck = () => {
+ const { theme } = this.props;
+ return ;
+ }
+
render() {
const { isMasterDetail, insets } = this.props;
const statusBarHeight = insets?.top ?? 0;
@@ -150,58 +153,50 @@ class Sort extends PureComponent {
}
]}
>
- }
+ color={themes[theme].auxiliaryText}
onPress={this.close}
- theme={theme}
- >
-
-
-
- {I18n.t('Sorting_by', { key: I18n.t(sortBy === 'alphabetical' ? 'name' : 'activity') })}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ translateTitle={false}
+ />
+
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={this.sortByName}
+ right={() => (sortBy === 'alphabetical' ? this.renderCheck() : null)}
+ />
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={this.sortByActivity}
+ right={() => (sortBy === 'activity' ? this.renderCheck() : null)}
+ />
+
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={this.toggleGroupByType}
+ right={() => (groupByType ? this.renderCheck() : null)}
+ />
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={this.toggleGroupByFavorites}
+ right={() => (showFavorites ? this.renderCheck() : null)}
+ />
+ }
+ color={themes[theme].auxiliaryText}
+ onPress={this.toggleUnread}
+ right={() => (showUnread ? this.renderCheck() : null)}
+ />
>
);
diff --git a/app/views/RoomsListView/styles.js b/app/views/RoomsListView/styles.js
index a921830a..beb04c92 100644
--- a/app/views/RoomsListView/styles.js
+++ b/app/views/RoomsListView/styles.js
@@ -15,56 +15,22 @@ export default StyleSheet.create({
alignItems: 'center',
flexDirection: 'row'
},
- sortToggleContainerClose: {
- position: 'absolute',
- top: 0,
- width: '100%'
- },
- sortToggleText: {
- fontSize: 16,
- flex: 1,
- ...sharedStyles.textRegular
- },
- queueToggleText: {
- fontSize: 16,
- flex: 1,
- ...sharedStyles.textRegular
- },
dropdownContainer: {
width: '100%',
position: 'absolute',
top: 0,
borderBottomWidth: StyleSheet.hairlineWidth
},
- sortItemButton: {
- height: 57,
- justifyContent: 'center'
- },
- sortItemContainer: {
- flexDirection: 'row',
- alignItems: 'center'
- },
- sortItemText: {
- fontSize: 18,
- flex: 1,
- ...sharedStyles.textRegular
- },
backdrop: {
...StyleSheet.absoluteFill
},
- sortSeparator: {
- height: StyleSheet.hairlineWidth,
- marginHorizontal: 12,
- flex: 1
- },
- sortIcon: {
- width: 22,
- height: 22,
- marginHorizontal: 12
- },
queueIcon: {
marginHorizontal: 12
},
+ omnichannelRightContainer: {
+ flexDirection: 'row',
+ alignItems: 'center'
+ },
groupTitleContainer: {
paddingHorizontal: 12,
paddingTop: 17,
@@ -90,56 +56,5 @@ export default StyleSheet.create({
marginRight: 12,
paddingVertical: 10,
...sharedStyles.textRegular
- },
- serverItem: {
- height: 68
- },
- serverItemContainer: {
- flexDirection: 'row',
- alignItems: 'center',
- height: 68
- },
- serverIcon: {
- width: 42,
- height: 42,
- marginHorizontal: 12,
- marginVertical: 13,
- borderRadius: 4,
- resizeMode: 'contain'
- },
- serverTextContainer: {
- flex: 1,
- flexDirection: 'column',
- justifyContent: 'center'
- },
- serverName: {
- fontSize: 18,
- ...sharedStyles.textSemibold
- },
- serverUrl: {
- fontSize: 16,
- ...sharedStyles.textRegular
- },
- serverSeparator: {
- height: StyleSheet.hairlineWidth,
- marginLeft: 72
- },
- encryptionButton: {
- width: '100%',
- flexDirection: 'row',
- alignItems: 'center',
- padding: 12
- },
- encryptionIcon: {
- ...sharedStyles.textMedium
- },
- encryptionText: {
- flex: 1,
- fontSize: 16,
- marginHorizontal: 16,
- ...sharedStyles.textMedium
- },
- omnichannelToggle: {
- marginRight: 12
}
});
diff --git a/storybook/stories/List.js b/storybook/stories/List.js
index 568fbc49..63201805 100644
--- a/storybook/stories/List.js
+++ b/storybook/stories/List.js
@@ -111,11 +111,20 @@ stories.add('with icon', () => (
));
-stories.add('with custom color', () => (
+stories.add('with custom colors', () => (
+ alert('Press')}
+ backgroundColor='red'
+ underlayColor='green'
+ translateTitle={false}
+ />
+
));