zoukankan      html  css  js  c++  java
  • react native 中使用swiper

    1.下载依赖

    cnpm install react-native-swiper --save 

    2.在组件中使用

    import React, { Component } from 'react';
    import { StyleSheet, View,Dimensions,Image} from 'react-native';
    import Swiper from 'react-native-swiper';
    export default class SideItem extends Component {
        render(){
            return(
                <View style={styles.container}>
                    <Swiper
                        style={styles.swiper}
                        height={220}
                        horizontal={true}
                        autoplay={true} 
                        paginationStyle={{bottom: 20}}
                        showsButtons={false}>
                        <Image source={require('../assets/images/1.png')} style={styles.img}/>
                        <Image source={require('../assets/images/2.png')} style={styles.img}/>
                        <Image source={require('../assets/images/3.png')} style={styles.img}/>
                    </Swiper>
                </View>
            )
        }
    }
    
    const styles = StyleSheet.create({
        container: {
            flex: 1
        },
        swiper: {},
        img: {
             Dimensions.width,
            height: 200,
        }
    });

    3.运行run-Android

  • 相关阅读:
    ModelMap和ModelAndView的作用
    jquery 临时存值
    条件sql ibatis
    IBATIS动态SQL
    MyEclipse 快捷键
    jquery $用法
    弹窗案例
    Ibatis sql语句1
    Ibatis sql语句
    jQuery的三种$()
  • 原文地址:https://www.cnblogs.com/ldlx-mars/p/9456438.html
Copyright © 2011-2022 走看看