import Icon, { IconName } from '@components/Icon' import { Loading } from '@components/Loading' import CustomText from '@components/Text' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import React from 'react' import { AccessibilityProps, Pressable, View } from 'react-native' export type Props = { accessibilityLabel?: string accessibilityHint?: string accessibilityState?: AccessibilityProps['accessibilityState'] native?: boolean background?: boolean loading?: boolean disabled?: boolean destructive?: boolean destructiveColor?: string onPress: () => void } & ({ type?: undefined; content: IconName } | { type: 'text'; content: string }) const HeaderRight: React.FC = ({ // Accessibility - Start accessibilityLabel, accessibilityHint, accessibilityState, // Accessibility - End type, content, native = true, background = false, loading, disabled, destructive = false, destructiveColor, onPress }) => { const { colors } = useTheme() const loadingSpinkit = () => loading ? ( ) : null const children = () => { switch (type) { case 'text': return ( <> {loadingSpinkit()} ) default: return ( <> {loadingSpinkit()} ) } } return ( ) } export default HeaderRight