import Icon, { IconName } from '@components/Icon' import { Loading } from '@components/Loading' import CustomText from '@components/Text' import { useAccessibility } from '@utils/accessibility/AccessibilityManager' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import { ColorDefinitions } from '@utils/styles/themes' import React from 'react' import { View } from 'react-native' import { State, Switch, TapGestureHandler } from 'react-native-gesture-handler' export interface Props { iconFront?: IconName iconFrontColor?: ColorDefinitions title: string description?: string content?: string | React.ReactNode badge?: boolean switchValue?: boolean switchDisabled?: boolean switchOnValueChange?: () => void iconBack?: 'chevron-right' | 'chevron-down' | 'external-link' | 'check' iconBackColor?: ColorDefinitions loading?: boolean onPress?: () => void } const MenuRow: React.FC = ({ iconFront, iconFrontColor = 'primaryDefault', title, description, content, badge = false, switchValue, switchDisabled, switchOnValueChange, iconBack, iconBackColor = 'secondary', loading = false, onPress }) => { const { colors } = useTheme() const { screenReaderEnabled } = useAccessibility() return ( { if (nativeEvent.state === State.ACTIVE && !loading) { if (screenReaderEnabled && switchOnValueChange) { switchOnValueChange() } else { if (onPress) onPress() } } }} > {iconFront && ( )} {badge ? ( ) : null} {title} {content || switchValue !== undefined || iconBack ? ( {content ? ( typeof content === 'string' ? ( {content} ) : ( content ) ) : null} {switchValue !== undefined ? ( ) : null} {iconBack ? ( ) : null} {loading ? ( ) : null} ) : null} {description ? ( {description} ) : null} ) } export default MenuRow