# Migrate from react-native-reanimated-carousel

> Switch from react-native-reanimated-carousel to Patine UI's Carousel: no Reanimated or gesture handler, children instead of renderItem, peeking slides, loop, autoplay that pauses on touch, dots and arrow keys on the web.

# Migrate from `react-native-reanimated-carousel`

```diff
- import Carousel from 'react-native-reanimated-carousel';
+ import { Carousel } from 'patine-ui';

- <Carousel
-   width={width}
-   height={200}
-   data={banners}
-   loop
-   autoPlay
-   autoPlayInterval={3000}
-   onSnapToItem={setIndex}
-   renderItem={({ item }) => <Banner banner={item} />}
- />
+ <Carousel loop autoplay={3000} onValueChange={setIndex} accessibilityLabel="Offers">
+   {banners.map((banner) => <Banner key={banner.id} banner={banner} />)}
+ </Carousel>
```

| react-native-reanimated-carousel | Patine UI |
| --- | --- |
| `data` + `renderItem` | one child per slide |
| `width` | fills its container; `itemWidth` (points or `'85%'`) for peeking slides |
| `height` | your slides' height |
| `loop` | `loop` |
| `autoPlay` + `autoPlayInterval` | `autoplay={ms}` (`true` is 4000); pauses on touch, hover and focus; off with reduce motion |
| `defaultIndex` | `defaultValue`, or `value` to control it |
| `onSnapToItem` | `onValueChange(index)` |
| `vertical` | `orientation="vertical"` |
| `mode="parallax"` / `customAnimation` | — |
| `ref.next()` / `ref.prev()` / `ref.scrollTo()` | set `value`, or the built-in arrows (`showArrows`) |
| `pagingEnabled` / `snapEnabled` | always snaps one slide per swipe |

Dots (`showIndicator`) are built in and follow the finger. There's no Reanimated or gesture handler to install: [`Carousel`](../../components/carousel) is a paging `ScrollView`.

See [all migration guides](./index.mdx) for other libraries, and [Comparison](../comparison.mdx) for when another library is the better choice.
