Skip to content

Commit

Permalink
added listview icon type, bump version to 6, closes issue react-nativ…
Browse files Browse the repository at this point in the history
  • Loading branch information
dabit3 committed Sep 25, 2016
1 parent 50af533 commit f883b3f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Readme.MD
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ const list = [
<ListItem
key={i}
title={item.title}
icon={{name: item.icon}}
leftIcon={{name: item.icon}}
/>
))
}
Expand Down Expand Up @@ -415,9 +415,9 @@ render () {
| component | View or TouchableHighlight if onPress method is added as prop | React Native element | replace element with custom element (optional) |
| containerStyle | none | object (style) | additional main container styling (optional) |
| hideChevron | false | boolean | set if you do not want a chevron (optional) |
| icon | none | object {name, color, style} | icon configuration for left icon (optional) |
| leftIcon | none | object {name, color, style, type} (type defaults to material icons) | icon configuration for left icon (optional) |
| rightIcon | {name: chevron} | object {name, color, style, type} (type defaults to material icons) | right icon (optional), will only show up if there is an onPress method attached ([material icon name](https://design.google.com/icons/)) |
| onPress | none | function | onPress method for link (optional) |
| rightIcon | chevron | string | right icon (optional) ([material icon name](https://design.google.com/icons/)) |
| roundAvatar | false | boolan | make left avatar round |
| subtitle | none | string | subtitle text (optional) |
| subtitleStyle | none | object (style) | additional subtitle styling (optional ) |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-elements",
"version": "0.5.4",
"version": "0.6.0",
"description": "React Native Elements & UI Toolkit",
"main": "src/index.js",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion src/icons/Icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ Icon.propTypes = {
reverse: PropTypes.bool,
raised: PropTypes.bool,
containerStyle: PropTypes.object,
iconStyle: PropTypes.object,
iconStyle: PropTypes.oneOfType([
PropTypes.object,
PropTypes.array
]),
onPress: PropTypes.func,
reverseColor: PropTypes.string
}
Expand Down
24 changes: 12 additions & 12 deletions src/list/ListItem.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'
import { View, StyleSheet, TouchableHighlight, Image, Platform } from 'react-native'
import Icon from 'react-native-vector-icons/MaterialIcons'
import Icon from '../icons/Icon'
import Text from '../text/Text'
import colors from '../config/colors'
import fonts from '../config/fonts'
Expand All @@ -9,7 +9,7 @@ let styles
const ListItem = ({
onPress,
title,
icon,
leftIcon,
rightIcon,
avatar,
avatarStyle,
Expand Down Expand Up @@ -39,12 +39,12 @@ const ListItem = ({
style={[styles.container, containerStyle && containerStyle]}>
<View style={[styles.wrapper, wrapperStyle && wrapperStyle]}>
{
icon && icon.name && (
leftIcon && leftIcon.name && (
<Icon
size={28}
style={[styles.icon, icon.style && icon.style]}
name={icon.name}
color={icon.color || colors.grey4}
type={leftIcon.type}
iconStyle={[styles.icon, leftIcon.style && leftIcon.style]}
name={leftIcon.name}
color={leftIcon.color || colors.grey4}
/>
)
}
Expand All @@ -64,14 +64,14 @@ const ListItem = ({
style={[
styles.title,
titleStyle && titleStyle,
!icon && {marginLeft: 10},
!leftIcon && {marginLeft: 10},
fontFamily && {fontFamily}
]}>{title}</Text>
{subtitle && (
<Text
style={[
styles.subtitle,
!icon && {marginLeft: 10},
!leftIcon && {marginLeft: 10},
subtitleStyle && subtitleStyle,
fontFamily && {fontFamily}
]}>{subtitle}</Text>
Expand All @@ -81,6 +81,7 @@ const ListItem = ({
onPress && !hideChevron && (
<View style={styles.chevronContainer}>
<Icon
type={rightIcon.type}
style={styles.chevron}
size={28}
name={rightIcon}
Expand Down Expand Up @@ -133,12 +134,11 @@ styles = StyleSheet.create({
flexDirection: 'row'
},
icon: {
marginRight: 10
marginRight: 8
},
title: {
fontSize: 15,
color: colors.grey1,
marginTop: -2
color: colors.grey1
},
subtitle: {
color: colors.grey3,
Expand Down

0 comments on commit f883b3f

Please sign in to comment.