react-native-swiper 异步获取图片无法正常轮播

文章有误,待确认更新!

---------------------------

首先,在代码中搞入以下代码: 

import Swiper from 'react-native-swiper';

<Swiper style={styles.wrapper} height={200} horizontal={true} autoplay autoplayTimeout={1} >

            {

              list && list.map((item, index) => {

                if (index < 3)

                  return (

                    <ImageAction key={index} style={styles.headImage} reqUrl={'/cms_service/common/getImage'} reqParams=                                   {[item.id, "newsLogo"]} />

                  )

              })

            }

</Swiper>

说出来你们可能不信,我这样子没有办法让轮播图自动轮播,并且指示点也没能正常移动,why?看看下面加个View容器:

<Swiper style={styles.wrapper} height={200} horizontal={true} autoplay autoplayTimeout={1} >

            {

              list && list.map((item, index) => {

                if (index < 3)

                  return (

                      <View style={styles.slide1}>

                               <ImageAction key={index} style={styles.headImage} reqUrl={'/cms_service/common/getImage'}                                           reqParams={[item.id, "newsLogo"]} />

                    </View>

                  )

              })

            }

</Swiper>

这就可以了。。。 

猜你喜欢

转载自blog.csdn.net/hzxOnlineOk/article/details/90406961