Skip to content

Commit c560741

Browse files
Himanshu SatijaHimanshu Satija
authored andcommitted
uniformity between icon and thumbnail items
1 parent d3c62dc commit c560741

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Components/Widgets/ListItem.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default class ListItemNB extends NativeBaseComponent {
7373
}
7474
}
7575

76-
isThumbnail() {
76+
thumbnailPresent() {
7777
var thumbnailComponentPresent = false;
7878
React.Children.forEach(this.props.children, function (child) {
7979
if(child.type == Thumbnail)
@@ -83,14 +83,24 @@ export default class ListItemNB extends NativeBaseComponent {
8383
return thumbnailComponentPresent;
8484
}
8585

86+
iconPresent() {
87+
var iconComponentPresent = false;
88+
React.Children.forEach(this.props.children, function (child) {
89+
if(child.type == Icon)
90+
iconComponentPresent = true;
91+
})
92+
93+
return iconComponentPresent;
94+
}
95+
8696
getChildStyle(child) {
8797
var mergedStyle = {};
8898
if(child.type == Icon) {
8999
return _.merge(mergedStyle, this.getInitialStyle().itemIcon, child.props.style);
90100
}
91101

92102
else if(child.type == Text) {
93-
if(child.props.note && this.isThumbnail())
103+
if(child.props.note && this.thumbnailPresent())
94104
return _.merge(mergedStyle, this.getInitialStyle().itemSubNote, child.props.style);
95105
else if(child.props.note)
96106
return _.merge(mergedStyle, this.getInitialStyle().itemNote, child.props.style);
@@ -152,7 +162,7 @@ export default class ListItemNB extends NativeBaseComponent {
152162
}
153163

154164
renderChildren() {
155-
if(!this.isThumbnail()) {
165+
if(!this.thumbnailPresent() && !this.iconPresent()) {
156166
var newChildren = React.Children.map(this.props.children, (child) => {
157167
return React.cloneElement(child, this.getChildProps(child));
158168
});

0 commit comments

Comments
 (0)