diff --git a/app/(tabs)/my.tsx b/app/(tabs)/my.tsx
index fc1a6b0..ca70c7f 100644
--- a/app/(tabs)/my.tsx
+++ b/app/(tabs)/my.tsx
@@ -20,6 +20,7 @@ import Toast from '@/components/ui/Toast'
import { signOut } from '@/lib/auth'
import { useTemplateGenerations, type TemplateGeneration } from '@/hooks'
import { MySkeleton } from '@/components/skeleton/MySkeleton'
+import { useSession } from '@/lib/auth'
const { width: screenWidth } = Dimensions.get('window')
const GALLERY_GAP = 2
@@ -36,7 +37,18 @@ export default function My() {
const router = useRouter()
const { t, i18n } = useTranslation()
const [editDrawerVisible, setEditDrawerVisible] = useState(false)
- const [profileName, setProfileName] = useState('乔乔乔乔')
+
+ // 获取当前登录用户信息
+ const { data: session } = useSession()
+ const userName = session?.user?.name || session?.user?.username || '用户'
+ const [profileName, setProfileName] = useState(userName)
+
+ // 当 session 变化时更新用户名
+ useEffect(() => {
+ if (session?.user?.name || session?.user?.username) {
+ setProfileName(session?.user?.name || session?.user?.username || '用户')
+ }
+ }, [session])
// 使用 useTemplateGenerations hook 获取用户作品列表
const {
@@ -148,7 +160,7 @@ export default function My() {
/>
{profileName}
- ID 12345678
+ ID {session?.user?.id?.slice(0, 8) || '--------'}