| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import React from "react";
- import { View, StyleSheet } from "react-native";
- const Circle = ({ isActive }: { isActive: boolean }) => {
- return <View style={isActive ? styles.activeCircle : styles.circle} />;
- };
- const PaginationIndicator = ({ totalPages, currentPage }: { totalPages: number; currentPage: number }) => {
- return (
- <View style={styles.container}>
- {Array.from({ length: totalPages }, (_, index) => (
- <Circle key={index} isActive={index === currentPage} />
- ))}
- </View>
- );
- };
- const styles = StyleSheet.create({
- container: {
- flexDirection: "row",
- justifyContent: "center",
- alignItems: "center",
- flex:1,
- },
- circle: {
- width: 16,
- height: 16,
- borderRadius: 10,
- backgroundColor: "#D9D9D9",
- margin: 5,
- },
- activeCircle: {
- width: 16,
- height: 16,
- borderRadius: 10,
- backgroundColor: "#02677D",
- margin: 5,
- },
- });
- export default PaginationIndicator;
|