Skip to content

Commit 553f0b4

Browse files
Sankhadeep RoySankhadeep Roy
authored andcommitted
Merge branch 'master' of github.com:GeekyAnts/NativeBase
2 parents 45741db + 692d05e commit 553f0b4

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

Components/Widgets/ListItem.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,28 @@ export default class ListItemNB extends NativeBaseComponent {
146146
}
147147

148148
renderChildren() {
149-
var newChildren = React.Children.map(this.props.children, (child) => {
150-
return React.cloneElement(child, this.getChildProps(child));
151-
});
152-
149+
if(!this.isThumbnail()) {
150+
var newChildren = React.Children.map(this.props.children, (child) => {
151+
return React.cloneElement(child, this.getChildProps(child));
152+
});
153+
}
154+
else {
155+
var newChildren = [];
156+
if(!Array.isArray(this.props.children)) {
157+
newChildren.push(React.cloneElement(this.props.children, this.getChildProps(this.props.children)));
158+
}
159+
else {
160+
var childrenArray = React.Children.toArray(this.props.children);
161+
newChildren.push(React.cloneElement(childrenArray[0], this.getChildProps(childrenArray[0])));
162+
newChildren.push(<View style={{backgroundColor: '#777'}}>
163+
{childrenArray.slice(1).map((child) => {
164+
return React.cloneElement(child, this.getChildProps(child));
165+
})}
166+
</View>);
167+
}
168+
169+
}
170+
153171
console.log(newChildren);
154172

155173
return newChildren;

0 commit comments

Comments
 (0)