0.0.3 • Published 4 years ago

native-cmos-carousel v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

React Native 轮播组件使用介绍

安装:

npm install native-cmos-carousel

参数:

NamepropTypedefault valuedescription
autoplaybooltrue自动播放
delaynumber4000延时
currentPagenumber0初始化当前页位置
bulletsboolfalse是否显示页面小圆点
bulletStylestylenull小圆点样式
bulletsContainerStylestylenull小圆点容器样式
chosenBulletStylestylenull选中小圆点的样式
heightnumbernull轮播图高度设置,默认为屏幕高度
widthnumbernull轮播图宽度设置,默认为屏幕宽度

使用示例:

    import React, { Component } from 'react';
    import {
      AppRegistry,
      StyleSheet,
      Text,
      View,
      Dimensions,
      Image,
    } from 'react-native';
    import Carousel from 'native-cmos-carousel';
    const { width, height } = Dimensions.get('window');

    export default class carouselTest extends Component {
      constructor(props) {
        super(props);
        this.state = {
          size: { width, height },
        };
      }

      render() {
        return (
          <View style={{ flex: 1 ,backgroundColor:'white'}}>
            <Carousel
              height={height/3}
              delay={2000}
              autoplay
              bullets
              bulletStyle={{backgroundColor:'white'}}
            >
              <Image
              style={{width:width,height:height/3}}
            source={{uri: 'http://www.10086.cn/cmpop/images/index/ad1/201609/20160914171036633bj1.jpg'}}
          />
              <Image
              style={{width:width,height:height/3}}
            source={{uri: 'http://www.10086.cn/cmpop/images/index/ad1/201607/201607291033143254wN.jpg'}}
          />
              <Image
              style={{width:width,height:height/3}}
            source={{uri: 'http://www.10086.cn/cmpop/images/index/ad1/201608/20160805134750658S64.jpg'}}
          />
            </Carousel>
          </View>
        );
      }
    }

    AppRegistry.registerComponent('carouselTest', () => carouselTest);

更新日志:

版本号日期说明
0.0.22017-4-25增加小圆点样式配置接口,小圆点是否可以点击等
0.0.32017-4-27解决滑动过程中卡顿现象,安卓与iOS方法执行不同步等问题,增加宽度高度配置等