💡
Check out the multiple animation demo for the full source code here (opens in a new tab)
import * as React from "react";
import { View } from "react-native";
import { Carousel } from "react-native-reanimated-carousel";
import { SBItem } from "@/components/SBItem";
import { window } from "@/constants/sizes";
const PAGE_WIDTH = window.width;
const COUNT = 6;
function Index() {
return (
<View
id="carousel-component"
dataSet={{ kind: "custom-animations", name: "multiple" }}
style={{ width: PAGE_WIDTH, height: PAGE_WIDTH / 2 }}
>
<Carousel
loop
autoplay
style={{ width: PAGE_WIDTH, height: PAGE_WIDTH / 2 }}
itemSize={PAGE_WIDTH / COUNT}
data={[...new Array(12).keys()]}
renderItem={({ index }) => (
<View style={{ width: PAGE_WIDTH / COUNT, height: PAGE_WIDTH / 2 }}>
<SBItem key={index} index={index} />
</View>
)}
/>
</View>
);
}
export default Index;