标签:sid cnpm bsp 技术分享 ret 技术 ati ott source
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: { width: Dimensions.width, height: 200, } });
3.运行run-Android
标签:sid cnpm bsp 技术分享 ret 技术 ati ott source
原文地址:https://www.cnblogs.com/ldlx-mars/p/9456438.html