chahinebrini d7b15e231a feat(theme): Dark Mode Wave 2 — blocker, mail, chat, community, notifications, all remaining screens
Wave 2 = ALLE app-files die in Wave 1 noch hardcoded waren. Komplette App-weit
theme-aware-Migration jetzt durch. Legacy `import { colors }` flat export
vollständig eliminiert.

Migrated this wave:

Top-level Screens:
- app/urge.tsx (makeStyles factory mit ~20 colors)
- app/room.tsx + dm.tsx + games.tsx
- app/(app)/chat.tsx + mail.tsx + coach.tsx + notifications.tsx
- app/profile/[userId].tsx + profile/edit.tsx (INPUT_STYLE in body moved)
- app/debug.tsx + auth/callback.tsx

Blocker (7):
- AddDomainSheet, CooldownBanner, DeactivationExplainerSheet, DomainGrid,
  ProtectionCard, ProtectionDetailsSheet, ProtectionLockedCard

Mail (3):
- ConnectMailSheet, EditMailAccountSheet, MailEmptyState

Chat (1):
- ChatBubble, ChatInput

Community/Posts/Notifications:
- PostCard, PostCardSkeleton, ComposeCard, PostCommentsSheet
- NotificationsDropdown
- StreakBadge (Nativewind classes durch inline dynamic styles ersetzt)

Reusable Sheets:
- WheelPickerModal, OptionsBottomSheet, DeviceLimitReachedSheet

Urge subsystem (5):
- InlineRatingDrawer, ShareSuccessDrawer, UrgeStats, SosFeedbackModal,
  Breathing

Profile components:
- DigaMissionBanner

Pattern: useColors() hook in component body, makeStyles(colors) factory wo
StyleSheet.create vorher hardcoded war. 11 base-tokens (bg/surface/
surfaceElevated/border/text/textMuted/brandOrange/brandBlue/success/error/
warning) nutzen colors.light vs colors.dark scheme.

Bewusst NICHT migriert (semantic colors):
- DigaMissionBanner amber (#fffbeb, #854d0e) — DiGA-brand, nicht neutral
- Lyra-thinking #3b82f6 in urge.tsx — Lyra-brand-color
- scrollDownBtn #374151 — intentional dark floating-button

TS clean. Test: Settings → Theme → Dark — alle screens sollen jetzt dunkel
werden ohne white-flashes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 14:51:02 +02:00

148 lines
4.3 KiB
TypeScript

/**
* WheelPickerModal — iOS-native UIPickerView style wheel via @react-native-picker/picker.
*
* Pattern:
* 1. User taps a row → setVisible(true)
* 2. Modal slides up bottom-sheet with native iOS wheel + Done/Cancel
* 3. Wheel scrolls through options, current selection highlighted
* 4. User taps "Fertig" → onSelect(value), modal closes
* 5. User taps "Abbrechen" or outside → modal closes without change
*
* Use für: lange Listen (Geburtsjahr 91 items, Bundesland 16, Stadt 30-50/Bundesland).
* Für kurze Listen (3-7 items) bleibt ActionSheet besser (siehe useNativeActionSheet).
*/
import { useEffect, useState } from 'react';
import { Modal, View, Text, Pressable } from 'react-native';
import { Picker } from '@react-native-picker/picker';
import { useColors } from '../lib/theme';
type Option<T> = { value: T; label: string };
type Props<T extends string | number> = {
visible: boolean;
title: string;
options: Option<T>[];
value: T | null;
onSelect: (value: T) => void;
onClose: () => void;
};
export function WheelPickerModal<T extends string | number>({
visible,
title,
options,
value,
onSelect,
onClose,
}: Props<T>) {
const colors = useColors();
// Tracks the wheel's current selection (separate from confirmed value).
// Initialized from `value` prop on each open.
const [tempValue, setTempValue] = useState<T | null>(value);
useEffect(() => {
if (visible) {
// First-open default: if no current value, pick first option.
setTempValue(value ?? options[0]?.value ?? null);
}
}, [visible, value, options]);
function handleConfirm() {
if (tempValue !== null && tempValue !== undefined) {
onSelect(tempValue);
}
onClose();
}
return (
<Modal
visible={visible}
transparent
animationType="slide"
onRequestClose={onClose}
>
<Pressable
onPress={onClose}
style={{
flex: 1,
// Kein darkening (User-Regel) — backdrop nur als Tap-to-close-Layer
backgroundColor: 'transparent',
justifyContent: 'flex-end',
}}
>
<Pressable onPress={() => {}}>
<View
style={{
backgroundColor: colors.bg,
borderTopLeftRadius: 18,
borderTopRightRadius: 18,
paddingBottom: 24,
}}
>
{/* Header: Cancel / Title / Done */}
<View
style={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: 16,
paddingVertical: 12,
borderBottomWidth: 1,
borderBottomColor: colors.border,
}}
>
<Pressable onPress={onClose} hitSlop={10}>
<Text
style={{
fontSize: 15,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
Abbrechen
</Text>
</Pressable>
<Text
style={{
fontSize: 15,
color: colors.text,
fontFamily: 'Nunito_700Bold',
}}
>
{title}
</Text>
<Pressable onPress={handleConfirm} hitSlop={10}>
<Text
style={{
fontSize: 15,
color: colors.brandOrange,
fontFamily: 'Nunito_700Bold',
}}
>
Fertig
</Text>
</Pressable>
</View>
{/* Wheel — native iOS UIPickerView */}
<Picker
selectedValue={tempValue ?? undefined}
onValueChange={(v) => setTempValue(v as T)}
style={{ width: '100%' }}
itemStyle={{ fontSize: 18, color: colors.text }}
>
{options.map((opt) => (
<Picker.Item
key={String(opt.value)}
label={opt.label}
value={opt.value}
/>
))}
</Picker>
</View>
</Pressable>
</Pressable>
</Modal>
);
}