react-native-scrollview-carousel2
v0.1.0
Published
A fully customizable React Native carousel component using ScrollView.
Maintainers
Readme
React Native ScrollView Carousel 🎠
A fully customizable and lightweight carousel for React Native built on top of only ScrollView.
🚀 Installation
npm install react-native-scrollview-carousel2
# or
yarn add react-native-scrollview-carousel2⚙️ Example Usage
import { Carousel } from "react-native-scrollview-carousel2";
import { Text, View } from "react-native";
export default function Example() {
const data = ["A", "B", "C"];
return (
<Carousel
data={data}
renderItem={(item) => (
<View style={{ height: 200, justifyContent: "center", alignItems: "center" }}>
<Text style={{ fontSize: 32 }}>{item}</Text>
</View>
)}
withPagination
/>
);
}| Prop | Type | Default | Description |
| -------------------------- | --------------------------------------- | -------------- | ------------------------------ |
| data | T[] | — | Data array to render |
| renderItem | (item: T, index: number) => ReactNode | — | Function to render each item |
| orientation | "horizontal" \| "vertical" | "horizontal" | Carousel direction |
| onSnapItem | (index: number) => void | — | Callback when item changes |
| withPagination | boolean | false | Show pagination dots |
| paginationStyle | ViewStyle | — | Style for pagination container |
| paginationDotStyle | ViewStyle | — | Style for each dot |
| activePaginationDotStyle | ViewStyle | — | Style for active dot |
