Skip to content
项目

dohooo/react-native-reanimated-carousel

在 GitHub 查看

关于

🎠 基于 Reanimated 和 Gesture Handler 构建的高性能、可定制 React Native 轮播组件。支持 iOS、Android 和 Web。

网站与应用

这些数字如何统计

可以做什么

  • A smaller, named-only API with descriptive TypeScript types.
  • Container sizing through style, with optional itemSize for a custom page distance.
  • Explicit layout, itemAnimation, snapMode, and orientation contracts.
  • Continuous logical progress plus signed pixel-level scrollOffsetValue.

实测星标增长

24小时
-1
7天
-1
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

react-native-reanimated-carousel

platforms npm npm github issues discord chat

A performant, customizable carousel for React Native, powered by Reanimated and Gesture Handler.

What you can build

Flavor Switcher Stories Cube Date Wheel Map Explorer

Each one is a full app screen built on <Carousel>. Browse all 20 scenes to drag them live and copy the code.

Migrating from v4

v5 requires React Native 0.80+, Reanimated 4.1+ and React Native Worklets 0.5+ (Expo SDK 54+). Apps still on Reanimated 3 can keep using v4 until they upgrade.

To upgrade, give this prompt to your AI coding agent:

Read https://rn-carousel.dev/migration-v5.md and upgrade react-native-reanimated-carousel to v5 in this project, then summarize what changed for my review.

v5 highlights

  • A smaller, named-only API with descriptive TypeScript types.
  • Container sizing through style, with optional itemSize for a custom page distance.
  • Explicit layout, itemAnimation, snapMode, and orientation contracts.
  • Continuous logical progress plus signed pixel-level scrollOffsetValue.
  • One Pagination component with loop-aware interpolation and accessible interactive dots.
  • Stable item identity through keyExtractor, horizontal RTL normalization, and package exports.

Installation

Expo projects should let Expo select compatible Reanimated and Worklets versions:

npx expo install react-native-reanimated-carousel react-native-reanimated react-native-worklets react-native-gesture-handler

React Native Community CLI projects can use their package manager:

yarn add react-native-reanimated-carousel react-native-reanimated react-native-worklets react-native-gesture-handler

Follow the official setup instructions for Reanimated and Gesture Handler.

Quick start

import * as React from "react";
import { Text, useWindowDimensions, View } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { Carousel } from "react-native-reanimated-carousel";

const data = ["First", "Second", "Third"];

export default function App() {
  const { width } = useWindowDimensions();

  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <View style={{ flex: 1, justifyContent: "center" }}>
        <Carousel
          style={{ width, height: 200 }}
          data={data}
          renderItem={({ item }) => (
            <View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
              <Text>{item}</Text>
            </View>
          )}
        />
      </View>
    </GestureHandlerRootView>
  );
}

loop defaults to false in v5. Add loop when infinite wrapping is part of the product behavior.

Version compatibility

Carousel Expo SDK React Native Reanimated Gesture Handler Worklets
v5 54–58 validated 0.80+ 4.1.0+ >=2.9.0 <4.0.0 0.5.0+
v4.x (EOL) 50–53 0.70.3+ 3.0.0+ 2.9.0+ —
v3.x (EOL) 47–49 0.66.0+ 2.0.0+ 2.0.0+ —

Reanimated and Worklets must be a compatible pair. Expo users should use expo install; other projects should consult the Reanimated compatibility table.

Sponsors

License

MIT

探索相关项目

加载中…