import React, { useState } from 'react'; import { View, Text, StyleSheet, TouchableHighlight, GestureResponderEvent, } from 'react-native'; import theme from '../config/theme'; const styles = StyleSheet.create({ container: { width: '100%', height: '100%', }, tabBar: { flex: 1, flexDirection: 'row', maxHeight: 48, width: '100%', backgroundColor: theme.colors.bg, }, tab: { flex: 1, height: 48, backgroundColor: theme.colors.bg, alignItems: 'center', justifyContent: 'center', }, tabTitle: { color: theme.colors.description, fontSize: 16, // fontFamily: 'Inter', fontStyle: 'normal', fontWeight: '400', lineHeight: 16, }, }); type TabProps = { title: string; onPress: (event: GestureResponderEvent) => void; selected: boolean; }; const Tab: React.FC = ({ title, onPress, selected }: TabProps) => { console.log({ title }); const selectedColor = selected ? { color: theme.colors.saucy } : {}; const selectedBorder = selected ? { borderColor: theme.colors.saucy, borderBottomWidth: 1 } : {}; return ( {title} ); }; export type Page = { title: string; content: React.ReactNode; }; type PagerProps = { pages: Page[]; }; const Pager = ({ pages }: PagerProps) => { const [page, setPage] = useState(0); const currentPage = pages[page]; if (!currentPage) return null; return ( {pages.map((p, i) => { const selected = i === page; return ( setPage(i)} /> ); })} {currentPage.content} ); }; export default Pager;