2018-08-31 16:46:33 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Text, View, TouchableOpacity, Image, StyleSheet } from 'react-native';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
import I18n from '../../../i18n';
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
flex: 1,
|
2018-09-11 16:32:52 +00:00
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center'
|
2018-08-31 16:46:33 +00:00
|
|
|
},
|
|
|
|
button: {
|
|
|
|
flexDirection: 'row'
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
fontSize: 14,
|
|
|
|
color: '#0C0D0F'
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
fontSize: 12,
|
|
|
|
color: '#1D74F5'
|
|
|
|
},
|
|
|
|
disclosure: {
|
|
|
|
marginLeft: 3,
|
|
|
|
marginTop: 2,
|
|
|
|
width: 12,
|
|
|
|
height: 9
|
|
|
|
},
|
|
|
|
upsideDown: {
|
|
|
|
transform: [{ scaleY: -1 }]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const Header = ({ onPress, serverName, showServerDropdown }) => (
|
|
|
|
<View style={styles.container}>
|
2018-09-05 18:15:03 +00:00
|
|
|
<TouchableOpacity
|
|
|
|
onPress={onPress}
|
|
|
|
testID='rooms-list-header-server-dropdown-button'
|
|
|
|
style={styles.container}
|
|
|
|
>
|
|
|
|
<Text style={styles.title}>{I18n.t('Messages')}</Text>
|
2018-08-31 16:46:33 +00:00
|
|
|
<View style={styles.button}>
|
|
|
|
<Text style={styles.server}>{serverName}</Text>
|
|
|
|
<Image style={[styles.disclosure, showServerDropdown && styles.upsideDown]} source={{ uri: 'disclosure_indicator_server' }} />
|
|
|
|
</View>
|
|
|
|
</TouchableOpacity>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
|
|
|
|
Header.propTypes = {
|
|
|
|
onPress: PropTypes.func.isRequired,
|
|
|
|
serverName: PropTypes.string,
|
|
|
|
showServerDropdown: PropTypes.bool.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
Header.defaultProps = {
|
|
|
|
serverName: 'Rocket.Chat'
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Header;
|