JSPM

  • Created
  • Published
  • Downloads 221874
  • Score
    100M100P100Q178370F
  • License MIT

Simple carousel component.fully implemented using Reanimated 2.Infinitely scrolling, very smooth.

Package Exports

  • react-native-reanimated-carousel
  • react-native-reanimated-carousel/lib/commonjs/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-reanimated-carousel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

English | 简体中文

react-native-reanimated-carousel

platforms npm npm npm github issues github closed issues discord chat

  • It completely solves this [problem] for react-native-snap-carousel!
  • SimpleInfinitely scrolling very smoothFully implemented using Reanimated 2!

V2 has been released! Join it! [v1 docs]

Support to Web [demo]

Click on the image to see the code snippets. [Try it] 🍺

Now you can make cool animations with us! Very easy! [Details]

Table of contents

  1. Installation
  2. Usage
  3. Props
  4. Tips
  5. Reason
  6. Example

Installation

Open a Terminal in the project root and run:

yarn add react-native-reanimated-carousel

Or if you use npm:

npm install react-native-reanimated-carousel

Now we need to install react-native-gesture-handler and react-native-reanimated(>=2.0.0).

Usage

import Carousel from 'react-native-reanimated-carousel';

<Carousel
    width={300}
    height={150}
    data={[1, 2, 3]}
    renderItem={({ item }) => <AnyElement />}
/>;

Tips

  • Optimizing

    • When rendering a large number of elements, you can use the 'windowSize' property to control how many items of the current element are rendered. The default is full rendering. After testing without this property, frames will drop when rendering 200 empty views. After setting this property, rendering 1000 empty views is still smooth. (The specific number depends on the phone model tested)
  • RTL

    • Support to RTL mode with no more configuration needed. But in RTL mode, need to manually set the autoPlayReverse props for autoplay to control scrolling direction.
  • EXPO

    • If use EXPO managed workflow please ensure that the version is greater than 41.Because the old version not support Reanimated(v2).

Reason

The common RN infinite scroll component. It get stuck on a fast slide. Wait for the next element to appear. This component will not have similar problems.Because using a completely different approach so the best performance is achieved.That's why this library was created.

Use react-native-snap-carousel for quick swiping,you can see caton clearly when you reach the junction.(gif 4.6mb)

Compared with react-native-reanimated-carousel,The actual test was ten slides per second, but it didn't show up very well in gif.

Example

:pretty use pretty images

yarn ios
yarn ios:pretty

yarn android
yarn android:pretty

yarn web
yarn web:pretty

Sponsors

License

MIT