import React, { useState } from 'react'; import { View, Text, ScrollView, StyleSheet, } from 'react-native'; import { Ux4gPaginationDotted } from '../components/pagination/Pagination'; import { Ux4gButton } from '../components/button/Button'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; export const PaginationShowcase: React.FC = () => { const theme = useUx4gTheme(); const colors = theme.colors; const [page1, setPage1] = useState(0); const [page2, setPage2] = useState(1); const [page3, setPage3] = useState(2); const [page4, setPage4] = useState(0); const [page5, setPage5] = useState(1); const [page6, setPage6] = useState(2); const cardStyle = [ styles.card, { backgroundColor: theme.isDark ? '#1F1F1F' : '#FFFFFF', borderColor: theme.isDark ? '#333333' : '#E4E4E7', }, ]; const titleStyle = [ styles.sectionTitle, { color: theme.isDark ? '#F4F4F5' : '#18181B' }, ]; const subtitleStyle = [ styles.subText, { color: theme.isDark ? '#A1A1AA' : '#71717A' }, ]; const activePageLabelStyle = [ styles.activePageLabel, { color: theme.isDark ? '#E4E4E7' : '#3F3F46' }, ]; return ( 📄 Pagination Component (`Ux4gPaginationDotted`) Ported from Flutter `pagination.dart`. Supports sizes (`small`, `medium`), variants (`default`, `capsule`), `arrowsOnRight` layout, smooth animated dot transitions, interactive navigation, and custom color overrides. {/* 1. Default Variant & Interactive Page State */} 1. Default Variant (`default`) & Page Navigation Standard pagination with arrows on left/right. Tap any dot or arrow button to switch active page! setPage1(index)} /> Page {page1 + 1} of 5 0} onPress={() => setPage1((p) => Math.max(0, p - 1))} /> setPage1((p) => Math.min(4, p + 1))} /> {/* 2. Capsule Variant */} 2. Capsule Variant (`capsule`) Enclosed within a rounded pill container matching Flutter capsule styling. setPage2(index)} /> Page {page2 + 1} of 5 {/* 2b. Capsule Variant without Arrows */} Capsule Variant without Arrows Rounded pill container encapsulating indicator dots without navigation arrows. setPage6(index)} /> {/* 3. Sizes Comparison */} 3. Size Variants (`small` vs `medium`) `small` (dotSize: 10, arrowSize: 24) vs `medium` (dotSize: 12, arrowSize: 32). Small Size (`small`): setPage3(index)} /> Medium Size (`medium`): setPage3(index)} /> {/* 4. Arrows on Right Alignment */} 4. Arrows on Right (`arrowsOnRight = true`) Renders dots on the left and both arrow controls grouped on the right. Default Layout with `arrowsOnRight`: setPage4(index)} /> Capsule Layout with `arrowsOnRight`: setPage4(index)} /> {/* 5. Custom Color Overrides & Without Arrows */} 5. Custom Colors & Dots Only (`showArrows = false`) Custom `activeColor`, `inactiveColor`, and `inactiveBorderColor` overrides. Custom Emerald Green Scheme: setPage5(index)} activeColor="#10B981" inactiveColor={theme.isDark ? '#064E3B' : '#D1FAE5'} inactiveBorderColor="#059669" /> Dots Only without Arrow Buttons: setPage5(index)} activeColor="#EC4899" /> {/* 6. Disabled State */} 6. Disabled State (`enabled = false`) Non-interactive state with dimmed active indicator dot and disabled arrow buttons. {}} /> ); }; const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { padding: 16, paddingBottom: 40, }, header: { marginBottom: 16, }, title: { fontSize: 22, fontWeight: '800', marginBottom: 6, }, subText: { fontSize: 14, lineHeight: 20, }, card: { borderWidth: 1, borderRadius: 16, padding: 16, marginBottom: 16, }, sectionTitle: { fontSize: 16, fontWeight: '700', marginBottom: 4, }, demoRow: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginTop: 14, flexWrap: 'wrap', gap: 12, }, buttonRow: { flexDirection: 'row', gap: 10, marginTop: 16, }, activePageLabel: { fontSize: 13, fontWeight: '600', }, columnGroup: { marginTop: 12, }, fullWidthDemo: { width: '100%', marginTop: 6, }, });