Search and room icons layout improvements

This commit is contained in:
Rodrigo Nascimento 2017-08-10 17:26:11 -03:00
parent 3c2fd626af
commit f80d56a53e
2 changed files with 33 additions and 16 deletions

View File

@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
import Ionicons from 'react-native-vector-icons/Ionicons'; import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { View, Text, StyleSheet } from 'react-native'; import { View, Text, StyleSheet } from 'react-native';
@ -25,12 +24,14 @@ const styles = StyleSheet.create({
}, },
roomItem: { roomItem: {
flexGrow: 1, flexGrow: 1,
fontSize: 20 fontSize: 20,
color: '#444'
}, },
icon: { icon: {
fontSize: 20, fontSize: 18,
height: 22, marginTop: 5,
width: 22 marginRight: 5,
color: '#aaa'
} }
}); });
@ -41,13 +42,14 @@ export default class RoomItem extends React.PureComponent {
get icon() { get icon() {
const icon = { const icon = {
d: 'at', d: 'at',
c: 'hashtag', c: 'pound',
p: 'md-lock' p: 'lock',
l: 'account'
}[this.props.item.t]; }[this.props.item.t];
if (!icon) { if (!icon) {
return null; return null;
} }
return ['p'].includes(this.props.item.t) ? <Ionicons name={icon} style={styles.icon} /> : <FontAwesome name={icon} style={styles.icon} />; return <MaterialCommunityIcons name={icon} style={styles.icon} />;
} }
renderNumber = (item) => { renderNumber = (item) => {
if (item.unread) { if (item.unread) {

View File

@ -42,6 +42,19 @@ const styles = StyleSheet.create({
fontSize: 20, fontSize: 20,
height: 22, height: 22,
color: 'white' color: 'white'
},
searchBoxView: {
// borderBottomWidth: 1,
// borderBottomColor:
backgroundColor: '#eee',
},
searchBox: {
backgroundColor: '#fff',
margin: 5,
borderRadius: 5,
padding: 5,
paddingLeft: 10,
color: '#aaa'
} }
}); });
@ -235,6 +248,7 @@ export default class RoomsListView extends React.Component {
); );
renderSearchBar = () => ( renderSearchBar = () => (
<View style={styles.searchBoxView}>
<TextInput <TextInput
style={styles.searchBox} style={styles.searchBox}
value={this.state.searchText} value={this.state.searchText}
@ -242,6 +256,7 @@ export default class RoomsListView extends React.Component {
returnKeyType='search' returnKeyType='search'
placeholder='Search' placeholder='Search'
/> />
</View>
); );
renderList = () => { renderList = () => {