import React, { FC, ReactNode } from 'react'; import { Text, TouchableOpacity, View } from 'react-native'; import { NavigationProp, useNavigation } from '@react-navigation/native'; import { styles } from './styles'; import { Header, PageWrapper } from '../../../../components'; import { NAVIGATION_PAGES } from '../../../../types'; import { Colors } from '../../../../theme'; import UserPenIcon from '../../../../../assets/icons/user-pen.svg'; import UserPlusIcon from '../../../../../assets/icons/user-plus.svg'; import BellIcon from '../../../../../assets/icons/bell.svg'; import MailIcon from '../../../../../assets/icons/mail.svg'; import FAQIcon from '../../../../../assets/icons/faq.svg'; import DocumentIcon from '../../../../../assets/icons/document.svg'; import ShieldIcon from '../../../../../assets/icons/shield.svg'; import ExitIcon from '../../../../../assets/icons/exit.svg'; import UserXMark from '../../../../../assets/icons/user-xmark.svg'; import ArrowRightIcon from '../../../../../assets/icons/right-arrow.svg'; type ButtonType = { label: string; icon: ReactNode; red?: boolean; buttonFn?: (navigationHook: NavigationProp) => void; }; const buttons: ButtonType[] = [ { label: 'Edit Profile', icon: , buttonFn: (navigation) => { navigation.navigate(NAVIGATION_PAGES.EDIT_PERSONAL_INFO); } }, { label: 'Invite a Friend', icon: }, { label: 'Notification', icon: }, { label: 'Contact Us', icon: }, { label: 'FAQs', icon: }, { label: 'Terms & Conditions', icon: }, { label: 'Privacy Notice', icon: }, { label: 'Logout', icon: , red: true }, { label: 'Delete account', icon: , red: true } ]; const Settings = () => { return (
{buttons.map((button) => ( ))} ); }; type ButtonProps = { label: string; icon: ReactNode; buttonFn?: (navigate: NavigationProp) => void; red?: boolean; }; const SettingsButton: FC = ({ label, icon, buttonFn, red }) => { const navigation = useNavigation(); return ( (buttonFn ? buttonFn(navigation) : null)} > {icon} {label} ); }; export default Settings;