diff --git a/app/views/RoomView/Header/index.js b/app/views/RoomView/Header/index.js
index 7b29da837..9317b9706 100644
--- a/app/views/RoomView/Header/index.js
+++ b/app/views/RoomView/Header/index.js
@@ -1,85 +1,28 @@
import React from 'react';
-import { Text, View, Platform, TouchableOpacity, TextInput } from 'react-native';
+import { Text, View, Platform, TouchableOpacity } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
-import Modal from 'react-native-modal';
-import { CachedImage } from 'react-native-img-cache';
+import { HeaderBackButton } from 'react-navigation';
import Avatar from '../../../containers/Avatar';
-import RocketChat from '../../../lib/rocketchat';
import { STATUS_COLORS } from '../../../constants/colors';
-import { setSearch } from '../../../actions/rooms';
import styles from './styles';
@connect(state => ({
user: state.login.user,
baseUrl: state.settings.Site_Url
-}), dispatch => ({
- setSearch: searchText => dispatch(setSearch(searchText))
}))
export default class extends React.Component {
static propTypes = {
navigation: PropTypes.object.isRequired,
user: PropTypes.object.isRequired,
- baseUrl: PropTypes.string,
- setSearch: PropTypes.func
- }
-
- constructor(props) {
- super(props);
- this.state = {
- isModalVisible: false,
- searching: false
- };
- }
-
- onPressModalButton(status) {
- RocketChat.setUserPresenceDefaultStatus(status);
- this.hideModal();
- }
-
- onSearchChangeText(text) {
- this.props.setSearch(text.trim());
- }
-
- onPressCancelSearchButton() {
- this.setState({ searching: false });
- this.props.setSearch('');
- }
-
- onPressSearchButton() {
- this.setState({ searching: true });
- requestAnimationFrame(() => {
- this.inputSearch.focus();
- });
- }
-
- showModal() {
- this.setState({ isModalVisible: true });
- }
-
- hideModal() {
- this.setState({ isModalVisible: false });
- }
-
- createChannel() {
- this.props.navigation.navigate('SelectUsers');
+ baseUrl: PropTypes.string
}
renderLeft() {
return (
-
- this.props.navigation.navigate('DrawerOpen')}
- >
-
-
-
+ this.props.navigation.goBack(null)} tintColor='#292E35' />
);
}
@@ -96,62 +39,31 @@ export default class extends React.Component {
style={{ marginRight: 5 }}
baseUrl={this.props.baseUrl}
/>
- {this.props.user.username}
+
+ {this.props.user.username}
+ Online
+
);
}
- renderRight() {
- return (
-
- {Platform.OS === 'android' ?
- this.onPressSearchButton()}
- >
-
- : null}
- {Platform.OS === 'ios' ?
- this.createChannel()}
- >
-
- : null}
-
- );
- }
-
- renderModalButton = (status, text) => {
- const statusStyle = [styles.status, { backgroundColor: STATUS_COLORS[status] }];
- const textStyle = { flex: 1, fontWeight: this.props.user.status === status ? 'bold' : 'normal' };
- return (
+ renderRight = () => (
+
this.onPressModalButton(status)}
+ style={styles.headerButton}
+ onPress={() => {}}
>
-
-
- {text || status.charAt(0).toUpperCase() + status.slice(1)}
-
+
- );
- };
+
+ );
- renderHeader() {
- if (this.state.searching) {
- return null;
- }
+ render() {
return (
{this.renderLeft()}
@@ -160,60 +72,4 @@ export default class extends React.Component {
);
}
-
- renderSearch() {
- if (!this.state.searching) {
- return null;
- }
- return (
-
-
- this.onPressCancelSearchButton()}
- >
-
-
-
- this.inputSearch = inputSearch}
- underlineColorAndroid='transparent'
- style={styles.inputSearch}
- onChangeText={text => this.onSearchChangeText(text)}
- returnKeyType='search'
- placeholder='Search'
- clearButtonMode='while-editing'
- blurOnSubmit
- />
-
- );
- }
-
- render() {
- return (
-
- {this.renderHeader()}
- {this.renderSearch()}
- this.hideModal()}
- onBackdropPress={() => this.hideModal()}
- >
-
- {this.renderModalButton('online')}
- {this.renderModalButton('busy')}
- {this.renderModalButton('away')}
- {this.renderModalButton('offline', 'Invisible')}
-
-
-
- );
- }
}
diff --git a/app/views/RoomsListView/Header/index.js b/app/views/RoomsListView/Header/index.js
index 7b29da837..302fce5fe 100644
--- a/app/views/RoomsListView/Header/index.js
+++ b/app/views/RoomsListView/Header/index.js
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Modal from 'react-native-modal';
import { CachedImage } from 'react-native-img-cache';
+import { HeaderBackButton } from 'react-navigation';
import Avatar from '../../../containers/Avatar';
import RocketChat from '../../../lib/rocketchat';
@@ -168,17 +169,7 @@ export default class extends React.Component {
return (
- this.onPressCancelSearchButton()}
- >
-
-
+ this.onPressCancelSearchButton()} />
this.inputSearch = inputSearch}