refactor(ui): implement custom header system and unify screen layouts
Some checks failed
Frontend CI / ota-android (push) Successful in 1m30s
Frontend CI / build-and-push-web (push) Successful in 12m29s
Frontend CI / build-android-apk (push) Failing after 3h10m38s

Refactor the navigation and header strategy by replacing native stack headers with a custom `SimpleHeader` component across most profile and detail screens. This provides a more consistent UI/UX and better control over layout behavior.

- Implement `SimpleHeader` component in `src/components/common`.
- Disable native header rendering in `app/(app)/(tabs)/profile/_layout.tsx` and `app/_layout.tsx`.
- Update profile sub-screens to use `SimpleHeader` and `StatusBar` from `expo-status-bar`.
- Refactor `PostDetailScreen` to use a custom header implementation for better integration with the post author information.
- Update `UserScreen` to wrap content in `SafeAreaView` with the new header.
- Adjust `AppBackButton` to support transparent backgrounds.
This commit is contained in:
2026-05-03 22:01:43 +08:00
parent 490a99ab3c
commit 4213d13b8f
21 changed files with 522 additions and 173 deletions

View File

@@ -50,6 +50,7 @@ const styles = StyleSheet.create({
marginLeft: -12,
marginRight: 0,
padding: 0,
backgroundColor: 'transparent',
},
});

View File

@@ -0,0 +1,55 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { useAppColors, spacing } from '../../theme';
import { AppBackButton, Text } from './index';
interface SimpleHeaderProps {
title: string;
onBack: () => void;
rightComponent?: React.ReactNode;
}
export const SimpleHeader: React.FC<SimpleHeaderProps> = ({ title, onBack, rightComponent }) => {
const colors = useAppColors();
return (
<View style={[styles.header, { backgroundColor: colors.background.paper }]}>
<AppBackButton onPress={onBack} style={styles.backButton} />
<Text style={[styles.title, { color: colors.text.primary }]} numberOfLines={1}>
{title}
</Text>
{rightComponent ? (
<View style={styles.rightContainer}>
{rightComponent}
</View>
) : (
<View style={styles.rightPlaceholder} />
)}
</View>
);
};
const styles = StyleSheet.create({
header: {
flexDirection: 'row',
alignItems: 'center',
height: 52,
paddingHorizontal: spacing.xs,
},
title: {
flex: 1,
fontSize: 17,
fontWeight: '600',
marginLeft: spacing.xs,
},
rightContainer: {
flexDirection: 'row',
alignItems: 'center',
},
rightPlaceholder: {
width: 40,
},
backButton: {
marginLeft: 0,
},
});

View File

@@ -18,6 +18,7 @@ export { default as ResponsiveGrid } from './ResponsiveGrid';
export { default as ResponsiveStack, HStack, VStack } from './ResponsiveStack';
export { default as AdaptiveLayout, SidebarLayout } from './AdaptiveLayout';
export { default as AppBackButton } from './AppBackButton';
export { SimpleHeader } from './SimpleHeader';
export { default as PagerView } from './PagerView';
// 图片相关组件