关于轮播图控件在安卓环境下不显示的解决方案:
constructor(props) {
super(props);
this.state={
swiperShow:false,
};
}
componentDidMount(){
setTimeout(()=>{
this.setState({swiperShow:true});
},0)
}
renderSwiper=()=>{
if(this.state.swiperShow){
return(
<Swiper height={150} autoplay={true}>
{BANNER_LIST.map((item, i) => {
return <Image source={require('../image/banner.jpg')}/>;
})}
</Swiper>
);
} else {
return <View style={{height:150}}></View>;
}
}
网友评论