Files
frontend/src/screens/profile/UserScreen.tsx

34 lines
1.1 KiB
TypeScript
Raw Normal View History

/**
* UserScreen
* -
* 使 UserProfileScreen mode='other'
*/
import React from 'react';
import { useLocalSearchParams, useRouter } from 'expo-router';
import { SafeAreaView } from 'react-native-safe-area-context';
import UserProfileScreen from './UserProfileScreen';
import { useCurrentUser } from '../../stores/auth';
import { SimpleHeader } from '../../components/common';
export const UserScreen: React.FC = () => {
const { userId: userIdParam } = useLocalSearchParams<{ userId?: string }>();
const router = useRouter();
const userId = userIdParam || '';
const currentUser = useCurrentUser();
const isSelfProfile = !!currentUser?.id && currentUser.id === userId;
return (
<SafeAreaView style={{ flex: 1 }} edges={['top', 'bottom']}>
<SimpleHeader title="用户主页" onBack={() => router.back()} />
<UserProfileScreen
mode={isSelfProfile ? 'self' : 'other'}
userId={isSelfProfile ? undefined : userId}
hasHeader
/>
</SafeAreaView>
);
};
export default UserScreen;