当我在renderItem中使用return时,会显示一张空幻灯片
我的代码如下
<Carousel
ref={c => {
this._carousel = c;
}}
data={object}
renderItem={({ item, index }) => this.render(item, index)}
sliderWidth={sliderWidth}
itemWidth={ITEM_WIDTH}
contentContainerCustomStyle={{ alignItems: "center" }}
activeSlideAlignment={"start"}
inactiveSlideScale={1}
inactiveSlideOpacity={1}
/>;
render(item, index) {
if (index == 1) {
return;
} else {
return (
<View>
<Text>1</Text>
</View>
);
}
}
请帮助