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;

效果图

相关推荐
小溪彼岸5 分钟前
一键切换Cluade、Codex供应商配置,CC Switch你值得一试
前端
2501_9160088910 分钟前
API接口调试全攻略 Fiddler抓包工具、HTTPS配置与代理设置实战指南
前端·ios·小程序·https·fiddler·uni-app·webview
Halo_tjn13 分钟前
Set集合专项实验
java·开发语言·前端·python
m0_5649149216 分钟前
EDGE浏览器如何在新标签页打开收藏?EDGE浏览器如何打开书签不覆盖原网页?如何默认在新建标签页打开收藏夹书签?
前端·edge
司铭鸿31 分钟前
图论中的协同寻径:如何找到最小带权子图实现双源共达?
linux·前端·数据结构·数据库·算法·图论
风宇啸天1 小时前
令牌桶按用户维度限流
前端
safestar20121 小时前
React 19 深度解析:从并发模式到数据获取的架构革命
前端·javascript·react.js
越努力越幸运5081 小时前
npm常见问题解决
前端·npm·node.js
Wild~~1 小时前
electron-vite
前端·javascript·electron
by__csdn1 小时前
Electron+Vite:实现electron + vue3 + ts + pinia + vite高效跨平台开发指南
前端·javascript·vue.js·typescript·electron·node.js·vue