Skip to main content

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-carouselPatine UI
data + renderItemone child per slide
widthfills its container; itemWidth (points or '85%') for peeking slides
heightyour slides' height
looploop
autoPlay + autoPlayIntervalautoplay={ms} (true is 4000); pauses on touch, hover and focus; off with reduce motion
defaultIndexdefaultValue, or value to control it
onSnapToItemonValueChange(index)
verticalorientation="vertical"
mode="parallax" / customAnimation—
ref.next() / ref.prev() / ref.scrollTo()set value, or the built-in arrows (showArrows)
pagingEnabled / snapEnabledalways 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.