From ada6bf8ad418d8179c59382669f8d5ab6a3f4511 Mon Sep 17 00:00:00 2001 From: diegolmello Date: Thu, 10 Oct 2019 15:15:53 -0300 Subject: [PATCH] Header --- app/constants/colors.js | 2 +- app/containers/SearchBox.js | 14 +++++++------- app/views/RoomsListView/Header/Header.ios.js | 16 +++++++++------- app/views/RoomsListView/Header/index.js | 7 +++++-- app/views/RoomsListView/ListHeader/SearchBar.js | 13 ++++++++++--- app/views/RoomsListView/index.js | 4 +++- 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/app/constants/colors.js b/app/constants/colors.js index 8ac26ecfdf..0dcf0623d4 100644 --- a/app/constants/colors.js +++ b/app/constants/colors.js @@ -35,7 +35,7 @@ export const SWITCH_TRACK_COLOR = { export const themes = { light: { backgroundColor: '#ffffff', - focusedBackground: '#f8f8f8', + focusedBackground: isIOS ? '#f8f8f8' : '#2f343d', chatComponentBackground: '#f3f4f5', auxiliaryBackground: '#eeeef4', bannerBackground: '#f1f2f4', diff --git a/app/containers/SearchBox.js b/app/containers/SearchBox.js index 51c6caea4a..0dc4993ed7 100644 --- a/app/containers/SearchBox.js +++ b/app/containers/SearchBox.js @@ -6,7 +6,6 @@ import PropTypes from 'prop-types'; import Touchable from 'react-native-platform-touchable'; import I18n from '../i18n'; -import { isIOS } from '../utils/deviceInfo'; import { CustomIcon } from '../lib/Icons'; import sharedStyles from '../views/Styles'; import { withTheme } from '../theme'; @@ -14,14 +13,12 @@ import { themes } from '../constants/colors'; const styles = StyleSheet.create({ container: { - // backgroundColor: isIOS ? '#F7F8FA' : '#54585E', flexDirection: 'row', alignItems: 'center', flex: 1 }, searchBox: { alignItems: 'center', - backgroundColor: '#E1E5E8', borderRadius: 10, color: '#8E8E93', flexDirection: 'row', @@ -61,20 +58,22 @@ const SearchBox = ({ onChangeText, onSubmitEditing, testID, hasCancel, onCancelPress, theme, ...props }) => ( - - + + @@ -87,7 +86,8 @@ SearchBox.propTypes = { onSubmitEditing: PropTypes.func, hasCancel: PropTypes.bool, onCancelPress: PropTypes.func, - testID: PropTypes.string + testID: PropTypes.string, + theme: PropTypes.string }; export default withTheme(SearchBox); diff --git a/app/views/RoomsListView/Header/Header.ios.js b/app/views/RoomsListView/Header/Header.ios.js index 09adacfec1..8907249d13 100644 --- a/app/views/RoomsListView/Header/Header.ios.js +++ b/app/views/RoomsListView/Header/Header.ios.js @@ -6,7 +6,7 @@ import PropTypes from 'prop-types'; import I18n from '../../../i18n'; import sharedStyles from '../../Styles'; -import { COLOR_PRIMARY } from '../../../constants/colors'; +import { COLOR_PRIMARY, themes } from '../../../constants/colors'; const styles = StyleSheet.create({ container: { @@ -19,7 +19,7 @@ const styles = StyleSheet.create({ }, title: { fontSize: 14, - ...sharedStyles.textColorTitle, + // ...sharedStyles.textColorTitle, ...sharedStyles.textRegular }, server: { @@ -39,7 +39,7 @@ const styles = StyleSheet.create({ } }); -const HeaderTitle = React.memo(({ connecting, isFetching }) => { +const HeaderTitle = React.memo(({ connecting, isFetching, theme }) => { let title = I18n.t('Messages'); if (connecting) { title = I18n.t('Connecting'); @@ -47,11 +47,11 @@ const HeaderTitle = React.memo(({ connecting, isFetching }) => { if (isFetching) { title = I18n.t('Updating'); } - return {title}; + return {title}; }); const Header = React.memo(({ - connecting, isFetching, serverName, showServerDropdown, onPress + connecting, isFetching, serverName, showServerDropdown, onPress, theme }) => ( - + {serverName} @@ -73,6 +73,7 @@ Header.propTypes = { connecting: PropTypes.bool, isFetching: PropTypes.bool, serverName: PropTypes.string, + theme: PropTypes.string, showServerDropdown: PropTypes.bool.isRequired, onPress: PropTypes.func.isRequired }; @@ -83,7 +84,8 @@ Header.defaultProps = { HeaderTitle.propTypes = { connecting: PropTypes.bool, - isFetching: PropTypes.bool + isFetching: PropTypes.bool, + theme: PropTypes.string }; export default Header; diff --git a/app/views/RoomsListView/Header/index.js b/app/views/RoomsListView/Header/index.js index db169eca7d..df7d132a3c 100644 --- a/app/views/RoomsListView/Header/index.js +++ b/app/views/RoomsListView/Header/index.js @@ -6,6 +6,7 @@ import { toggleServerDropdown, closeServerDropdown, closeSortDropdown, setSearch as setSearchAction } from '../../../actions/rooms'; import Header from './Header'; +import { withTheme } from '../../../theme'; class RoomsListHeaderView extends PureComponent { static propTypes = { @@ -15,6 +16,7 @@ class RoomsListHeaderView extends PureComponent { serverName: PropTypes.string, connecting: PropTypes.bool, isFetching: PropTypes.bool, + theme: PropTypes.string, open: PropTypes.func, close: PropTypes.func, closeSort: PropTypes.func, @@ -44,11 +46,12 @@ class RoomsListHeaderView extends PureComponent { render() { const { - serverName, showServerDropdown, showSearchHeader, connecting, isFetching + serverName, showServerDropdown, showSearchHeader, connecting, isFetching, theme } = this.props; return (
({ setSearch: searchText => dispatch(setSearchAction(searchText)) }); -export default connect(mapStateToProps, mapDispatchtoProps)(RoomsListHeaderView); +export default connect(mapStateToProps, mapDispatchtoProps)(withTheme(RoomsListHeaderView)); diff --git a/app/views/RoomsListView/ListHeader/SearchBar.js b/app/views/RoomsListView/ListHeader/SearchBar.js index 31e0372d33..148aeecf66 100644 --- a/app/views/RoomsListView/ListHeader/SearchBar.js +++ b/app/views/RoomsListView/ListHeader/SearchBar.js @@ -3,10 +3,17 @@ import PropTypes from 'prop-types'; import SearchBox from '../../../containers/SearchBox'; import { isIOS } from '../../../utils/deviceInfo'; +import { withTheme } from '../../../theme'; -const SearchBar = React.memo(({ onChangeSearchText }) => { +const SearchBar = React.memo(({ theme, onChangeSearchText }) => { if (isIOS) { - return ; + return ( + + ); } return null; }); @@ -15,4 +22,4 @@ SearchBar.propTypes = { onChangeSearchText: PropTypes.func }; -export default SearchBar; +export default withTheme(SearchBar); diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index 8cbd679816..40222b0f7e 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -81,7 +81,8 @@ class RoomsListView extends React.Component { ); return { - headerStyle: { backgroundColor: themes[screenProps.theme].backgroundColor }, + headerStyle: { backgroundColor: themes[screenProps.theme].focusedBackground }, + headerTintColor: themes[screenProps.theme].tintColor, headerLeft: searching ? (