RN的轮播图组件

自行安装

js 复制代码
yarn add react-native-swiper

示例代码

js 复制代码
import React, {useRef, useEffect} from 'react';
import {View, Text} from 'react-native';
import Swiper from 'react-native-swiper';

const MySwiper = () => {

  return (
    <Swiper autoplay={true}>
      {/* 设置 autoplay 为 false,关闭自动播放 */}
      <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <Text>Slide 1</Text>
      </View>
      <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <Text>Slide 2</Text>
      </View>
      <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
        <Text>Slide 3</Text>
      </View>
    </Swiper>
  );
};

export default MySwiper;

效果图

相关推荐
We་ct1 小时前
LeetCode 77. 组合:DFS回溯+剪枝,高效求解组合问题
开发语言·前端·算法·leetcode·typescript·深度优先·剪枝
KerwinChou_CN1 小时前
什么是流式输出,后端怎么生成,前端怎么渲染
前端
爱上妖精的尾巴2 小时前
8-20 WPS JS宏 正则表达式-懒惰匹配
服务器·前端·javascript
网络点点滴2 小时前
组件通信props方式
前端·javascript·vue.js
二十雨辰2 小时前
[小结]-线上Bug监控
前端·bug
前端技术2 小时前
【鸿蒙实战】从零打造智能物联网家居控制系统:HarmonyOS Next分布式能力的完美诠释
java·前端·人工智能·分布式·物联网·前端框架·harmonyos
CHU7290352 小时前
指尖践行环保——旧衣服回收小程序前端功能玩法详解
前端·小程序
LawrenceLan2 小时前
38.Flutter 零基础入门(三十八):网络请求实战 http、dio —— 获取列表与刷新 UI
开发语言·前端·flutter·dart
csdn_aspnet2 小时前
Asp.Net Core 10.0 中的 Blazor 增强功能
前端·后端·asp.net·blazor·.net10
SuperEugene2 小时前
Excel 上传解析 + 导出实战:Vue+xlsx 避坑指南|Vue生态精选
前端·javascript·vue.js·excel·xlsx·vxetable