import { View, Text, Pressable, ActivityIndicator } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; import { useState } from 'react'; import { useTranslation } from 'react-i18next'; type Props = { remainingFormatted: string; // "23:59:42" onCancel: () => Promise; }; export function CooldownBanner({ remainingFormatted, onCancel }: Props) { const { t } = useTranslation(); const [cancelling, setCancelling] = useState(false); async function handleCancel() { setCancelling(true); try { await onCancel(); } finally { setCancelling(false); } } return ( {t('blocker.cooldown_banner_title')} {remainingFormatted} ({ paddingHorizontal: 12, paddingVertical: 8, borderRadius: 12, backgroundColor: '#16a34a', opacity: pressed || cancelling ? 0.7 : 1, })} > {cancelling ? ( ) : ( {t('common.cancel')} )} ); }