swiper 轮播图

通过npm安装:npm install react-native-swiper --save

import React, {Component} from 'react'
import {
    StyleSheet,
    Text,
    View,
    Image,
    Dimensions
} from 'react-native'
import Swiper from 'react-native-swiper'
let {height, width} = Dimensions.get('window');

const styles =StyleSheet.create( {
    wrapper: {
    }, //整体样式
  image:{

      height:height,
      width:width

  }
});

export default class HomePage extends Component{
    render(){
        return(



                <Swiper style={styles.wrapper}
                        showsButtons={true}       //为false时不显示控制按钮
                        paginationStyle={{      //小圆点位置
                            bottom: 70
                        }}
                        loop={false}        //如果设置为false,那么滑动到最后一张时,再次滑动将不会滑到第一张图片。
                        autoplay={true}          //自动轮播
                        autoplayTimeout={2}      //每隔2秒切换
                >

                    <Image style={styles.image} source={require('./Image/1.png')}/>
                    <Image style={styles.image} source={require('./Image/2.png')}/>
                    <Image style={styles.image} source={require('./Image/4.png')}/>
                    <Image style={styles.image} source={require('./Image/3.png')}/>
                    <Image style={styles.image} source={require('./Image/5.png')}/>


                </Swiper>

        )
    }
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值