File tree Expand file tree Collapse file tree 2 files changed +38
-24
lines changed
Expand file tree Collapse file tree 2 files changed +38
-24
lines changed Original file line number Diff line number Diff line change 88 UIManager ,
99 LayoutAnimation ,
1010 FlatList ,
11- StyleSheet
11+ StyleSheet ,
12+ Image
1213} from 'react-native'
1314import Icon from 'react-native-vector-icons/MaterialIcons'
1415import RowSubItem from './RowSubItem'
@@ -163,6 +164,7 @@ class RowItem extends Component {
163164 itemNumberOfLines,
164165 displayKey,
165166 selectedItems,
167+ iconKey
166168 } = this . props
167169 const hasDropDown = item [ subKey ] && item [ subKey ] . length > 0 && showDropDowns
168170
@@ -187,6 +189,12 @@ class RowItem extends Component {
187189 paddingVertical : 6 ,
188190 } , mergedStyles . item , this . _itemSelected ( item ) && mergedStyles . selectedItem ] }
189191 >
192+
193+ { iconKey && item [ iconKey ] && < Image source = { item [ iconKey ] } style = { [ {
194+ width :16 ,
195+ marginHorizontal :10
196+ } , mergedStyles . itemIconStyle ] } /> }
197+
190198 < Text
191199 numberOfLines = { itemNumberOfLines }
192200 style = {
@@ -198,7 +206,7 @@ class RowItem extends Component {
198206 mergedStyles . itemText , this . _itemSelected ( item ) && mergedStyles . selectedItemText
199207 ] }
200208 >
201- { item [ displayKey ] }
209+ { item [ displayKey ] }
202210 </ Text >
203211 {
204212 this . _itemSelected ( item ) ?
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class RowSubItem extends Component {
5555 highlightedChildren,
5656 itemNumberOfLines,
5757 displayKey,
58+ iconKey
5859 } = this . props
5960
6061 const highlightChild = ! selectChildren && highlightedChildren . includes ( subItem [ uniqueKey ] )
@@ -80,39 +81,44 @@ class RowSubItem extends Component {
8081 paddingVertical : 6 ,
8182 } , mergedStyles . subItem , ( itemSelected || highlightChild ) && mergedStyles . selectedItem ] }
8283 >
84+ { iconKey && item [ iconKey ] && < Image source = { item [ iconKey ] } style = { [ {
85+ width : 16 ,
86+ marginHorizontal : 10
87+ } , mergedStyles . itemIconStyle ] } /> }
88+
8389 < Text
8490 numberOfLines = { itemNumberOfLines }
8591 style = {
8692 [ {
87- flex : 1 ,
93+ flex : 1 ,
8894 color : subItem . disabled ? mergedColors . disabled : mergedColors . subText ,
89- } ,
90- subItemFontFamily ,
91- mergedStyles . subItemText ,
92- ( itemSelected || highlightChild ) && mergedStyles . selectedSubItemText ,
95+ } ,
96+ subItemFontFamily ,
97+ mergedStyles . subItemText ,
98+ ( itemSelected || highlightChild ) && mergedStyles . selectedSubItemText ,
9399 ]
94100 }
95101 >
96102 { subItem [ displayKey ] }
97103 </ Text >
98104 {
99- itemSelected || highlightChild ?
100- < View >
101- { selectedIconComponent ?
102- selectedIconComponent
103- :
104- < Icon
105- name = "check"
106- style = { {
107- fontSize : 16 ,
108- color : highlightChild ? mergedColors . disabled : mergedColors . success ,
109- paddingLeft : 10 ,
110- } }
111- />
112- }
113- </ View >
114- :
115- null
105+ itemSelected || highlightChild ?
106+ < View >
107+ { selectedIconComponent ?
108+ selectedIconComponent
109+ :
110+ < Icon
111+ name = "check"
112+ style = { {
113+ fontSize : 16 ,
114+ color : highlightChild ? mergedColors . disabled : mergedColors . success ,
115+ paddingLeft : 10 ,
116+ } }
117+ />
118+ }
119+ </ View >
120+ :
121+ null
116122 }
117123 </ TouchableOpacity >
118124 </ View >
You can’t perform that action at this time.
0 commit comments