fix(native): domains-section flat, mails-section collapsible only

DomainSection bekommt collapsible-Prop (default false).
Domains-Section: kein Chevron, kein useState, Content immer sichtbar.
Mails-Section: collapsible={true} + open/onToggle wie bisher.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-16 02:20:38 +02:00
parent f4da81f551
commit e370842072

View File

@ -61,8 +61,6 @@ export default function BlockerScreen() {
}, [refreshDomains, syncBlocklist, refresh]);
useDomainSubmissionRealtime(onDomainChange, true);
// Section collapse state — beide Sections starten offen
const [webOpen, setWebOpen] = useState(true);
const [mailOpen, setMailOpen] = useState(true);
// AddSheet state: tracks which section opened it
@ -369,8 +367,6 @@ export default function BlockerScreen() {
title={t('blocker.section_domains')}
count={countsByType.web}
max={limits.web}
open={webOpen}
onToggle={() => setWebOpen((v) => !v)}
onAdd={() => openAddSheet('web')}
atLimit={countsByType.web >= limits.web}
>
@ -388,6 +384,7 @@ export default function BlockerScreen() {
title={t('blocker.section_mails')}
count={countsByType.mail}
max={limits.mail}
collapsible
open={mailOpen}
onToggle={() => setMailOpen((v) => !v)}
onAdd={() => openAddSheet('mail')}
@ -448,7 +445,8 @@ function DomainSection({
title,
count,
max,
open,
collapsible = false,
open = true,
onToggle,
onAdd,
atLimit,
@ -457,8 +455,9 @@ function DomainSection({
title: string;
count: number;
max: number;
open: boolean;
onToggle: () => void;
collapsible?: boolean;
open?: boolean;
onToggle?: () => void;
onAdd: () => void;
atLimit: boolean;
children: React.ReactNode;
@ -496,8 +495,8 @@ function DomainSection({
>
{/* Section Header */}
<TouchableOpacity
onPress={onToggle}
activeOpacity={0.7}
onPress={collapsible ? onToggle : undefined}
activeOpacity={collapsible ? 0.7 : 1}
style={{
flexDirection: 'row',
alignItems: 'center',
@ -521,14 +520,16 @@ function DomainSection({
{t('blocker.count_label', { count, max })}
</Text>
</View>
<Ionicons
name={open ? 'chevron-up' : 'chevron-down'}
size={16}
color={colors.textMuted}
/>
{collapsible && (
<Ionicons
name={open ? 'chevron-up' : 'chevron-down'}
size={16}
color={colors.textMuted}
/>
)}
</TouchableOpacity>
{open && (
{(!collapsible || open) && (
<View style={{ paddingHorizontal: 14, paddingBottom: 14, gap: 12 }}>
{/* Progressbar */}
<View