Skip to content

Commit 6339929

Browse files
authored
fix for child rendering under condition (#636)
1 parent bb39bf0 commit 6339929

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/components/carousel/index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,15 @@ export default class Carousel extends BaseComponent {
234234
};
235235

236236
renderChild = (child, key) => {
237-
const paddingLeft = this.shouldUsePageWidth() ? this.props.itemSpacings : undefined;
238-
239-
return (
240-
<View style={{width: this.state.pageWidth, paddingLeft}} key={key} collapsable={false}>
241-
{child}
242-
</View>
243-
);
237+
if (child) {
238+
const paddingLeft = this.shouldUsePageWidth() ? this.props.itemSpacings : undefined;
239+
240+
return (
241+
<View style={{width: this.state.pageWidth, paddingLeft}} key={key} collapsable={false}>
242+
{child}
243+
</View>
244+
);
245+
}
244246
};
245247

246248
renderChildren() {

0 commit comments

Comments
 (0)