美文网首页
工作笔记七

工作笔记七

作者: 挪威森林_29e6 | 来源:发表于2017-07-27 18:01 被阅读0次

关于轮播图控件在安卓环境下不显示的解决方案:

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>;

                     }

}

相关文章

网友评论

      本文标题:工作笔记七

      本文链接:https://www.haomeiwen.com/subject/mhxtlxtx.html