Migrate from react-native-reanimated-carousel
- 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 is a paging ScrollView.
See all migration guides for other libraries, and Comparison for when another library is the better choice.