chahinebrini 3c52d8869e feat(native): WIP checkpoint — Profile/Settings/Demographics + WheelPicker + Maestro
Rollback-Punkt vor Expo SDK 54 / RN 0.81 Upgrade.

UI/UX:
- Profile: ProfileHeader redesign (sign-in chip + member-since), StatsBar 3 pill cards,
  Demographics accordion completed (Geburtsjahr, Geschlecht, Familienstand, Beruf-split,
  Wohnort), Pro-Trial-Banner, Approved-Domains list, DigaMissionBanner
- Settings: section-based layout, neutral icons (matched Header dropdown style)
- Header dropdown: extended with logout + games-page link
- Notifications page: skeleton dummy data
- Locales: i18n keys for new screens

New components:
- WheelPickerModal: native iOS UIPickerView wheel for long lists (Geburtsjahr 91 items,
  Bundesland 16, Stadt 30+/Bundesland)
- OptionsBottomSheet: iOS-style options sheet (used briefly for Geschlecht, currently
  unused — kept for potential future use)
- germanCities.ts: Top-cities per Bundesland (DSGVO-clean static data)

New libs (NewArch-codegen verified):
- @react-native-menu/menu 2.0.0 (UIMenu wrapper, Apple HIG-konform)
- @lodev09/react-native-true-sheet 3.10.1 (UISheetPresentationController wrapper —
  ABER incompatible mit RN 0.79.6, Build-Error → Trigger für SDK-54-Upgrade)

Maestro E2E:
- Initial setup mit auth/community/profile/urge flows

Scripts:
- build-ios-clean.sh: Xcode DerivedData + ios/build cleanup vor expo run:ios

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 19:32:27 +02:00

146 lines
4.2 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 { colors } 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>) {
// 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,
backgroundColor: 'rgba(0,0,0,0.4)',
justifyContent: 'flex-end',
}}
>
<Pressable onPress={() => {}}>
<View
style={{
backgroundColor: '#ffffff',
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: '#e5e5e5',
}}
>
<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>
);
}