WellNuo/components/PageHeader.tsx
Sergei abcc380984 Sync all changes - profile restructure and scheme updates
- Restructured profile screens location
- Updated beneficiary detail page
- Updated API service
- Updated all scheme files (MainScheme, ENV API, Discussion, AppStore, SysAnal)
- Added PageHeader component

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-12 16:48:07 -08:00

67 lines
1.6 KiB
TypeScript

import React from 'react';
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { router } from 'expo-router';
import { AppColors, FontSizes, Spacing } from '@/constants/theme';
interface PageHeaderProps {
title: string;
onBack?: () => void;
rightElement?: React.ReactNode;
}
export function PageHeader({ title, onBack, rightElement }: PageHeaderProps) {
const handleBack = () => {
if (onBack) {
onBack();
} else {
router.back();
}
};
return (
<View style={styles.header}>
<TouchableOpacity style={styles.backButton} onPress={handleBack}>
<Ionicons name="chevron-back" size={28} color={AppColors.primary} />
</TouchableOpacity>
<Text style={styles.title}>{title}</Text>
<View style={styles.rightContainer}>
{rightElement || <View style={styles.placeholder} />}
</View>
</View>
);
}
const styles = StyleSheet.create({
header: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: Spacing.sm,
paddingVertical: Spacing.md,
backgroundColor: AppColors.background,
borderBottomWidth: 1,
borderBottomColor: AppColors.border,
},
backButton: {
width: 44,
height: 44,
justifyContent: 'center',
alignItems: 'center',
},
title: {
flex: 1,
fontSize: FontSizes.lg,
fontWeight: '600',
color: AppColors.textPrimary,
textAlign: 'center',
},
rightContainer: {
width: 44,
alignItems: 'flex-end',
},
placeholder: {
width: 44,
},
});